Documentation ¶
Index ¶
- Constants
- Variables
- func GetMySlaveUrl(address, schema string) (uri string, err error)
- func NewMetric(tp string) (metric.Collector, error)
- func Register(masters []string, myhost, tag string) error
- type CleanInfo
- type Cluster
- type ClusterConfig
- type ClusterStatus
- type LogExportRunner
- func (r *LogExportRunner) Cleaner() CleanInfo
- func (r *LogExportRunner) LagStats() (rl RunnerLag, err error)
- func (r *LogExportRunner) Name() string
- func (r *LogExportRunner) Reset() error
- func (r *LogExportRunner) Run()
- func (r *LogExportRunner) Status() RunnerStatus
- func (r *LogExportRunner) StatusBackup()
- func (r *LogExportRunner) StatusRestore()
- func (r *LogExportRunner) Stop()
- type Manager
- func (m *Manager) Add(confPath string)
- func (m *Manager) ForkRunner(confPath string, nconf RunnerConfig, errReturn bool) error
- func (m *Manager) Remove(confPath string) (err error)
- func (m *Manager) RemoveWithConfig(confPath string, isDelete bool) (err error)
- func (m *Manager) RestoreWebDir()
- func (m *Manager) Status() (rss map[string]RunnerStatus)
- func (m *Manager) Stop() error
- func (m *Manager) Watch(confsPath []string) (err error)
- type ManagerConfig
- type MetricConfig
- type MetricRunner
- func (_ *MetricRunner) Cleaner() CleanInfo
- func (mr *MetricRunner) Name() string
- func (mr *MetricRunner) Reset() error
- func (r *MetricRunner) Run()
- func (mr *MetricRunner) Status() RunnerStatus
- func (mr *MetricRunner) StatusBackup()
- func (mr *MetricRunner) StatusRestore()
- func (mr *MetricRunner) Stop()
- type PostParseRet
- type RegisterReq
- type Resetable
- type RestService
- func (rs *RestService) ClusterStatus() echo.HandlerFunc
- func (rs *RestService) DeleteClusterConfig() echo.HandlerFunc
- func (rs *RestService) DeleteConfig() echo.HandlerFunc
- func (rs *RestService) DeleteSlaves() echo.HandlerFunc
- func (rs *RestService) GetClusterConfigs() echo.HandlerFunc
- func (rs *RestService) GetConfig() echo.HandlerFunc
- func (rs *RestService) GetConfigs() echo.HandlerFunc
- func (rs *RestService) GetMetricKeys() echo.HandlerFunc
- func (rs *RestService) GetMetricOptions() echo.HandlerFunc
- func (rs *RestService) GetMetricUsages() echo.HandlerFunc
- func (rs *RestService) GetParserKeyOptions() echo.HandlerFunc
- func (rs *RestService) GetParserSampleLogs() echo.HandlerFunc
- func (rs *RestService) GetParserUsages() echo.HandlerFunc
- func (rs *RestService) GetReaderKeyOptions() echo.HandlerFunc
- func (rs *RestService) GetReaderUsages() echo.HandlerFunc
- func (rs *RestService) GetSenderKeyOptions() echo.HandlerFunc
- func (rs *RestService) GetSenderUsages() echo.HandlerFunc
- func (rs *RestService) GetTransformerOptions() echo.HandlerFunc
- func (rs *RestService) GetTransformerSampleConfigs() echo.HandlerFunc
- func (rs *RestService) GetTransformerUsages() echo.HandlerFunc
- func (rs *RestService) GetVersion() echo.HandlerFunc
- func (rs *RestService) Ping() echo.HandlerFunc
- func (rs *RestService) PostClusterConfig() echo.HandlerFunc
- func (rs *RestService) PostClusterConfigReset() echo.HandlerFunc
- func (rs *RestService) PostClusterConfigStart() echo.HandlerFunc
- func (rs *RestService) PostClusterConfigStop() echo.HandlerFunc
- func (rs *RestService) PostConfig() echo.HandlerFunc
- func (rs *RestService) PostConfigReset() echo.HandlerFunc
- func (rs *RestService) PostConfigStart() echo.HandlerFunc
- func (rs *RestService) PostConfigStop() echo.HandlerFunc
- func (rs *RestService) PostParse() echo.HandlerFunc
- func (rs *RestService) PostParserCheck() echo.HandlerFunc
- func (rs *RestService) PostReaderCheck() echo.HandlerFunc
- func (rs *RestService) PostRegister() echo.HandlerFunc
- func (rs *RestService) PostSenderCheck() echo.HandlerFunc
- func (rs *RestService) PostSlaveTag() echo.HandlerFunc
- func (rs *RestService) PostTag() echo.HandlerFunc
- func (rs *RestService) PutClusterConfig() echo.HandlerFunc
- func (rs *RestService) PutConfig() echo.HandlerFunc
- func (rs *RestService) Register() error
- func (rs *RestService) Slaves() echo.HandlerFunc
- func (rs *RestService) Status() echo.HandlerFunc
- func (rs *RestService) Stop()
- type Runner
- func NewCustomRunner(rc RunnerConfig, cleanChan chan<- cleaner.CleanSignal, ...) (runner Runner, err error)
- func NewRunner(rc RunnerConfig, cleanChan chan<- cleaner.CleanSignal) (runner Runner, err error)
- func NewRunnerWithService(info RunnerInfo, reader reader.Reader, cleaner *cleaner.Cleaner, ...) (runner Runner, err error)
- type RunnerConfig
- type RunnerInfo
- type RunnerLag
- type RunnerStatus
- type Service
- type Slave
- type SlaveConfig
- type StatusPersistable
- type TagReq
- type Version
Constants ¶
const ( StatusOK = "ok" StatusBad = "bad" StatusLost = "lost" )
const ( DefaultMyTag = "default" ContentType = "Content-Type" ApplicationJson = "application/json" )
const ( StatsShell = "stats" PREFIX = "/logkit" )
const ( SpeedUp = "up" SpeedDown = "down" SpeedStable = "stable" )
const (
KeyMetricType = "type"
)
Variables ¶
var DEFAULT_LOGKIT_REST_DIR = "/.logkitconfs"
var DEFAULT_PORT = 3000
var DIR_NOT_EXIST_SLEEP_TIME = "300" //300 s
var KeySampleLog = "sampleLog"
Functions ¶
func GetMySlaveUrl ¶ added in v1.3.6
Types ¶
type Cluster ¶ added in v1.3.6
type Cluster struct { ClusterConfig // contains filtered or unexported fields }
func NewCluster ¶ added in v1.3.6
func NewCluster(cc *ClusterConfig) *Cluster
func (*Cluster) RunRegisterLoop ¶ added in v1.3.6
func (*Cluster) UpdateSlaveStatus ¶ added in v1.3.6
func (cc *Cluster) UpdateSlaveStatus()
type ClusterConfig ¶ added in v1.3.6
type ClusterStatus ¶ added in v1.3.6
type ClusterStatus struct { Status map[string]RunnerStatus `json:"status"` Tag string `json:"tag"` Err error `json:"error"` }
type LogExportRunner ¶
type LogExportRunner struct { RunnerInfo // contains filtered or unexported fields }
func NewLogExportRunner ¶
func NewLogExportRunner(rc RunnerConfig, cleanChan chan<- cleaner.CleanSignal, ps *parser.ParserRegistry, sr *sender.SenderRegistry) (runner *LogExportRunner, err error)
func NewLogExportRunnerWithService ¶
func NewLogExportRunnerWithService(info RunnerInfo, reader reader.Reader, cleaner *cleaner.Cleaner, parser parser.LogParser, transformers []transforms.Transformer, senders []sender.Sender, meta *reader.Meta) (runner *LogExportRunner, err error)
func (*LogExportRunner) Cleaner ¶
func (r *LogExportRunner) Cleaner() CleanInfo
func (*LogExportRunner) LagStats ¶
func (r *LogExportRunner) LagStats() (rl RunnerLag, err error)
func (*LogExportRunner) Name ¶
func (r *LogExportRunner) Name() string
func (*LogExportRunner) Reset ¶ added in v1.3.1
func (r *LogExportRunner) Reset() error
func (*LogExportRunner) Run ¶
func (r *LogExportRunner) Run()
func (*LogExportRunner) Status ¶
func (r *LogExportRunner) Status() RunnerStatus
func (*LogExportRunner) StatusBackup ¶ added in v1.3.5
func (r *LogExportRunner) StatusBackup()
func (*LogExportRunner) StatusRestore ¶ added in v1.3.5
func (r *LogExportRunner) StatusRestore()
func (*LogExportRunner) Stop ¶
func (r *LogExportRunner) Stop()
type Manager ¶
type Manager struct { ManagerConfig DefaultDir string Version string SystemInfo string // contains filtered or unexported fields }
func NewCustomManager ¶
func NewCustomManager(conf ManagerConfig, pr *parser.ParserRegistry, sr *sender.SenderRegistry) (*Manager, error)
func NewManager ¶
func NewManager(conf ManagerConfig) (*Manager, error)
func (*Manager) ForkRunner ¶ added in v1.2.3
func (m *Manager) ForkRunner(confPath string, nconf RunnerConfig, errReturn bool) error
func (*Manager) RemoveWithConfig ¶ added in v1.3.5
func (*Manager) RestoreWebDir ¶ added in v1.2.3
func (m *Manager) RestoreWebDir()
func (*Manager) Status ¶
func (m *Manager) Status() (rss map[string]RunnerStatus)
type ManagerConfig ¶
type ManagerConfig struct { BindHost string `json:"bind_host"` Idc string `json:"idc"` Zone string `json:"zone"` RestDir string `json:"rest_dir"` Cluster ClusterConfig `json:"cluster"` }
type MetricConfig ¶ added in v1.3.6
type MetricRunner ¶
type MetricRunner struct { RunnerName string `json:"name"` // contains filtered or unexported fields }
func NewMetricRunner ¶
func NewMetricRunner(rc RunnerConfig, sr *sender.SenderRegistry) (runner *MetricRunner, err error)
func (*MetricRunner) Cleaner ¶
func (_ *MetricRunner) Cleaner() CleanInfo
func (*MetricRunner) Name ¶
func (mr *MetricRunner) Name() string
func (*MetricRunner) Reset ¶ added in v1.3.6
func (mr *MetricRunner) Reset() error
func (*MetricRunner) Run ¶
func (r *MetricRunner) Run()
func (*MetricRunner) Status ¶
func (mr *MetricRunner) Status() RunnerStatus
func (*MetricRunner) StatusBackup ¶ added in v1.3.6
func (mr *MetricRunner) StatusBackup()
func (*MetricRunner) StatusRestore ¶ added in v1.3.6
func (mr *MetricRunner) StatusRestore()
func (*MetricRunner) Stop ¶
func (mr *MetricRunner) Stop()
type PostParseRet ¶ added in v1.2.3
PostParseRet 返回值
type RegisterReq ¶ added in v1.3.6
type RestService ¶
type RestService struct {
// contains filtered or unexported fields
}
func NewRestService ¶
func NewRestService(mgr *Manager, router *echo.Echo) *RestService
func (*RestService) ClusterStatus ¶ added in v1.3.6
func (rs *RestService) ClusterStatus() echo.HandlerFunc
master API get /logkit/cluster/status?tag=tagValue&url=urlValue
func (*RestService) DeleteClusterConfig ¶ added in v1.3.6
func (rs *RestService) DeleteClusterConfig() echo.HandlerFunc
DELETE /logkti/cluster/configs/<name>?tag=tagValue&url=urlValue
func (*RestService) DeleteConfig ¶ added in v1.2.3
func (rs *RestService) DeleteConfig() echo.HandlerFunc
delete /logkit/configs/<name>
func (*RestService) DeleteSlaves ¶ added in v1.3.6
func (rs *RestService) DeleteSlaves() echo.HandlerFunc
DELETE /logkit/cluster/slaves?tag=tagValue&url=urlValue
func (*RestService) GetClusterConfigs ¶ added in v1.3.6
func (rs *RestService) GetClusterConfigs() echo.HandlerFunc
master API Get /logkit/cluster/configs?tag=tagValue&url=urlValue
func (*RestService) GetConfig ¶ added in v1.2.3
func (rs *RestService) GetConfig() echo.HandlerFunc
get /logkit/configs/:name
func (*RestService) GetConfigs ¶ added in v1.2.3
func (rs *RestService) GetConfigs() echo.HandlerFunc
get /logkit/configs
func (*RestService) GetMetricKeys ¶ added in v1.3.6
func (rs *RestService) GetMetricKeys() echo.HandlerFunc
GET /logkit/metric/keys
func (*RestService) GetMetricOptions ¶ added in v1.3.6
func (rs *RestService) GetMetricOptions() echo.HandlerFunc
GET /logkit/metric/options
func (*RestService) GetMetricUsages ¶ added in v1.3.6
func (rs *RestService) GetMetricUsages() echo.HandlerFunc
GET /logkit/metric/usages
func (*RestService) GetParserKeyOptions ¶ added in v1.2.3
func (rs *RestService) GetParserKeyOptions() echo.HandlerFunc
get /logkit/parser/options 获取解析选项
func (*RestService) GetParserSampleLogs ¶ added in v1.2.3
func (rs *RestService) GetParserSampleLogs() echo.HandlerFunc
get /logkit/parser/samplelogs 获取样例日志
func (*RestService) GetParserUsages ¶ added in v1.2.3
func (rs *RestService) GetParserUsages() echo.HandlerFunc
get /logkit/parser/usages 获得解析用途说明
func (*RestService) GetReaderKeyOptions ¶ added in v1.2.3
func (rs *RestService) GetReaderKeyOptions() echo.HandlerFunc
get /logkit/reader/options 获取Reader参数配置
func (*RestService) GetReaderUsages ¶ added in v1.2.3
func (rs *RestService) GetReaderUsages() echo.HandlerFunc
get /logkit/reader/usages 获取Reader用途
func (*RestService) GetSenderKeyOptions ¶ added in v1.2.3
func (rs *RestService) GetSenderKeyOptions() echo.HandlerFunc
get /logkit/sender/options 获取sender配置参数
func (*RestService) GetSenderUsages ¶ added in v1.2.3
func (rs *RestService) GetSenderUsages() echo.HandlerFunc
get /logkit/sender/usages 获取sender用途说明
func (*RestService) GetTransformerOptions ¶ added in v1.3.2
func (rs *RestService) GetTransformerOptions() echo.HandlerFunc
GET /logkit/transformer/options
func (*RestService) GetTransformerSampleConfigs ¶ added in v1.3.2
func (rs *RestService) GetTransformerSampleConfigs() echo.HandlerFunc
GET /logkit/transformer/sampleconfigs
func (*RestService) GetTransformerUsages ¶ added in v1.3.2
func (rs *RestService) GetTransformerUsages() echo.HandlerFunc
GET /logkit/transformer/usages
func (*RestService) GetVersion ¶ added in v1.3.1
func (rs *RestService) GetVersion() echo.HandlerFunc
func (*RestService) Ping ¶ added in v1.3.6
func (rs *RestService) Ping() echo.HandlerFunc
master API get /logkit/cluster/ping
func (*RestService) PostClusterConfig ¶ added in v1.3.6
func (rs *RestService) PostClusterConfig() echo.HandlerFunc
POST /logkit/cluster/configs/<name>?tag=tagValue&url=urlValue
func (*RestService) PostClusterConfigReset ¶ added in v1.3.6
func (rs *RestService) PostClusterConfigReset() echo.HandlerFunc
POST /logkit/cluster/configs/<name>/reset?tag=tagValue&url=urlValue
func (*RestService) PostClusterConfigStart ¶ added in v1.3.6
func (rs *RestService) PostClusterConfigStart() echo.HandlerFunc
POST /logkit/cluster/configs/<name>/start?tag=tagValue&url=urlValue
func (*RestService) PostClusterConfigStop ¶ added in v1.3.6
func (rs *RestService) PostClusterConfigStop() echo.HandlerFunc
POST /logkit/cluster/configs/<name>/stop?tag=tagValue&url=urlValue
func (*RestService) PostConfig ¶ added in v1.2.3
func (rs *RestService) PostConfig() echo.HandlerFunc
post /logkit/configs/<name>
func (*RestService) PostConfigReset ¶ added in v1.3.1
func (rs *RestService) PostConfigReset() echo.HandlerFunc
POST /logkit/configs/<name>/reset
func (*RestService) PostConfigStart ¶ added in v1.3.5
func (rs *RestService) PostConfigStart() echo.HandlerFunc
POST /logkit/configs/<name>/start
func (*RestService) PostConfigStop ¶ added in v1.3.5
func (rs *RestService) PostConfigStop() echo.HandlerFunc
POST /logkit/configs/<name>/stop
func (*RestService) PostParse ¶ added in v1.2.3
func (rs *RestService) PostParse() echo.HandlerFunc
post /logkit/parser/parse 接受解析请求
func (*RestService) PostParserCheck ¶ added in v1.2.4
func (rs *RestService) PostParserCheck() echo.HandlerFunc
POST /logkit/parser/check
func (*RestService) PostReaderCheck ¶ added in v1.2.4
func (rs *RestService) PostReaderCheck() echo.HandlerFunc
POST /logkit/reader/check 请求校验reader配置
func (*RestService) PostRegister ¶ added in v1.3.6
func (rs *RestService) PostRegister() echo.HandlerFunc
master API POST /logkit/cluster/register
func (*RestService) PostSenderCheck ¶ added in v1.2.4
func (rs *RestService) PostSenderCheck() echo.HandlerFunc
POST /logkit/sender/check 请求校验sender配置
func (*RestService) PostSlaveTag ¶ added in v1.3.6
func (rs *RestService) PostSlaveTag() echo.HandlerFunc
POST /logkit/cluster/slaves/tag?tag=tagValue&url=urlValue
func (*RestService) PostTag ¶ added in v1.3.6
func (rs *RestService) PostTag() echo.HandlerFunc
slave API POST /logkit/cluster/tag
func (*RestService) PutClusterConfig ¶ added in v1.3.6
func (rs *RestService) PutClusterConfig() echo.HandlerFunc
PUT /logkit/cluster/configs/<name>?tag=tagValue&url=urlValue
func (*RestService) PutConfig ¶ added in v1.3.1
func (rs *RestService) PutConfig() echo.HandlerFunc
put /logkit/configs/<name>
func (*RestService) Register ¶ added in v1.3.6
func (rs *RestService) Register() error
func (*RestService) Slaves ¶ added in v1.3.6
func (rs *RestService) Slaves() echo.HandlerFunc
master API get /logkit/cluster/slaves?tag=tagValue&url=urlValue
func (*RestService) Status ¶ added in v1.2.3
func (rs *RestService) Status() echo.HandlerFunc
get /logkit/status
type Runner ¶
type Runner interface { Name() string Run() Stop() Cleaner() CleanInfo Status() RunnerStatus }
func NewCustomRunner ¶
func NewCustomRunner(rc RunnerConfig, cleanChan chan<- cleaner.CleanSignal, ps *parser.ParserRegistry, sr *sender.SenderRegistry) (runner Runner, err error)
func NewRunner ¶
func NewRunner(rc RunnerConfig, cleanChan chan<- cleaner.CleanSignal) (runner Runner, err error)
NewRunner 创建Runner
func NewRunnerWithService ¶
func NewRunnerWithService(info RunnerInfo, reader reader.Reader, cleaner *cleaner.Cleaner, parser parser.LogParser, transformers []transforms.Transformer, senders []sender.Sender, meta *reader.Meta) (runner Runner, err error)
type RunnerConfig ¶
type RunnerConfig struct { RunnerInfo MetricConfig []MetricConfig `json:"metric,omitempty"` ReaderConfig conf.MapConf `json:"reader"` CleanerConfig conf.MapConf `json:"cleaner,omitempty"` ParserConf conf.MapConf `json:"parser"` Transforms []map[string]interface{} `json:"transforms,omitempty"` SenderConfig []conf.MapConf `json:"senders"` IsInWebFolder bool `json:"web_folder,omitempty"` IsStopped bool `json:"is_stopped,omitempty"` }
RunnerConfig 从多数据源读取,经过解析后,发往多个数据目的地
type RunnerInfo ¶
type RunnerInfo struct { RunnerName string `json:"name"` CollectInterval int `json:"collect_interval,omitempty"` // metric runner收集的频率 MaxBatchLen int `json:"batch_len,omitempty"` // 每个read batch的行数 MaxBatchSize int `json:"batch_size,omitempty"` // 每个read batch的字节数 MaxBatchInteval int `json:"batch_interval,omitempty"` // 最大发送时间间隔 MaxBatchTryTimes int `json:"batch_try_times,omitempty"` // 最大发送次数,小于等于0代表无限重试 CreateTime string `json:"createtime"` }
type RunnerStatus ¶
type RunnerStatus struct { Name string `json:"name"` Logpath string `json:"logpath"` ReadDataSize int64 `json:"readDataSize"` ReadDataCount int64 `json:"readDataCount"` Elaspedtime float64 `json:"elaspedtime"` Lag RunnerLag `json:"lag"` ReaderStats utils.StatsInfo `json:"readerStats"` ParserStats utils.StatsInfo `json:"parserStats"` SenderStats map[string]utils.StatsInfo `json:"senderStats"` TransformStats map[string]utils.StatsInfo `json:"transformStats"` Error string `json:"error,omitempty"` ReadSpeedKB float64 `json:"readspeed_kb"` ReadSpeed float64 `json:"readspeed"` ReadSpeedTrendKb string `json:"readspeedtrend_kb"` ReadSpeedTrend string `json:"readspeedtrend"` Tag string `json:"tag,omitempty"` Url string `json:"url,omitempty"` // contains filtered or unexported fields }
type SlaveConfig ¶ added in v1.3.6
type SlaveConfig struct { Configs map[string]RunnerConfig `json:"configs"` Tag string `json:"tag"` Err error `json:"error"` }
type StatusPersistable ¶ added in v1.3.5
type StatusPersistable interface { StatusBackup() StatusRestore() }