Merge pull request 'collect node logs automatically after associated' (#111) from agent_logs into master
This commit is contained in:
commit
461faa46e9
|
@ -725,6 +725,10 @@ func getAgentTaskSetting(agentID string, node agent.ESNodeInfo) (*agent.Setting,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
taskSetting.Logs = &model.LogsTask{
|
||||||
|
Enabled:true,
|
||||||
|
LogsPath: node.Path.Logs,
|
||||||
|
}
|
||||||
return &agent.Setting{
|
return &agent.Setting{
|
||||||
Metadata: agent.SettingsMetadata{
|
Metadata: agent.SettingsMetadata{
|
||||||
Category: "agent",
|
Category: "agent",
|
||||||
|
|
|
@ -220,9 +220,35 @@ func TransformSettingsToConfig(setting *model.TaskSetting, clusterID, nodeUUID s
|
||||||
toDeletePipelineNames = append(toDeletePipelineNames, getMetricPipelineName(nodeUUID, processorName))
|
toDeletePipelineNames = append(toDeletePipelineNames, getMetricPipelineName(nodeUUID, processorName))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if setting.Logs != nil {
|
||||||
|
var processorName = "es_logs_processor"
|
||||||
|
if setting.Logs.Enabled {
|
||||||
|
params := util.MapStr{
|
||||||
|
"elasticsearch": clusterID,
|
||||||
|
"queue_name": "logs",
|
||||||
|
}
|
||||||
|
if setting.Logs.LogsPath != "" {
|
||||||
|
params["logs_path"] = setting.Logs.LogsPath
|
||||||
|
}
|
||||||
|
cfg := util.MapStr{
|
||||||
|
processorName: params,
|
||||||
|
}
|
||||||
|
enabled := true
|
||||||
|
pipelineCfg := util.MapStr{
|
||||||
|
"enabled": &enabled,
|
||||||
|
"name": fmt.Sprintf("collect_%s_es_logs", nodeUUID),
|
||||||
|
"auto_start": true,
|
||||||
|
"keep_running": true,
|
||||||
|
"retry_delay_in_ms": 3000,
|
||||||
|
"processor": []util.MapStr{cfg},
|
||||||
|
}
|
||||||
|
pipelines = append(pipelines, pipelineCfg)
|
||||||
|
}
|
||||||
|
}
|
||||||
return pipelines, toDeletePipelineNames, nil
|
return pipelines, toDeletePipelineNames, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
func newClusterMetricPipeline(processorName string, clusterID string)(util.MapStr, error){
|
func newClusterMetricPipeline(processorName string, clusterID string)(util.MapStr, error){
|
||||||
cfg := util.MapStr{
|
cfg := util.MapStr{
|
||||||
processorName: util.MapStr{
|
processorName: util.MapStr{
|
||||||
|
|
|
@ -36,6 +36,7 @@ type NodeStatsTask struct {
|
||||||
|
|
||||||
type LogsTask struct {
|
type LogsTask struct {
|
||||||
Enabled bool `json:"enabled"`
|
Enabled bool `json:"enabled"`
|
||||||
|
LogsPath string `json:"logs_path"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ParseAgentSettingsResult struct {
|
type ParseAgentSettingsResult struct {
|
||||||
|
|
Loading…
Reference in New Issue