diff --git a/x-pack/elastic-agent/pkg/agent/operation/monitoring.go b/x-pack/elastic-agent/pkg/agent/operation/monitoring.go index 07491cbd6ab..14f26989cf2 100644 --- a/x-pack/elastic-agent/pkg/agent/operation/monitoring.go +++ b/x-pack/elastic-agent/pkg/agent/operation/monitoring.go @@ -264,6 +264,14 @@ func (o *Operator) getMonitoringFilebeatConfig(outputType string, output interfa }, }, }, + { + "add_fields": map[string]interface{}{ + "target": "agent", + "fields": map[string]interface{}{ + "id": o.agentInfo.AgentID(), + }, + }, + }, { "drop_fields": map[string]interface{}{ "fields": []string{ @@ -319,6 +327,14 @@ func (o *Operator) getMonitoringFilebeatConfig(outputType string, output interfa }, }, }, + { + "add_fields": map[string]interface{}{ + "target": "agent", + "fields": map[string]interface{}{ + "id": o.agentInfo.AgentID(), + }, + }, + }, { "drop_fields": map[string]interface{}{ "fields": []string{ @@ -339,16 +355,6 @@ func (o *Operator) getMonitoringFilebeatConfig(outputType string, output interfa "output": map[string]interface{}{ outputType: output, }, - "processors": []map[string]interface{}{ - { - "add_fields": map[string]interface{}{ - "target": "agent", - "fields": map[string]interface{}{ - "id": o.agentInfo.AgentID(), - }, - }, - }, - }, } return result, true @@ -398,6 +404,14 @@ func (o *Operator) getMonitoringMetricbeatConfig(outputType string, output inter }, }, }, + { + "add_fields": map[string]interface{}{ + "target": "agent", + "fields": map[string]interface{}{ + "id": o.agentInfo.AgentID(), + }, + }, + }, }, }, map[string]interface{}{ "module": "http", @@ -437,6 +451,14 @@ func (o *Operator) getMonitoringMetricbeatConfig(outputType string, output inter }, }, }, + { + "add_fields": map[string]interface{}{ + "target": "agent", + "fields": map[string]interface{}{ + "id": o.agentInfo.AgentID(), + }, + }, + }, { "copy_fields": map[string]interface{}{ "fields": []map[string]interface{}{ @@ -520,6 +542,14 @@ func (o *Operator) getMonitoringMetricbeatConfig(outputType string, output inter }, }, }, + { + "add_fields": map[string]interface{}{ + "target": "agent", + "fields": map[string]interface{}{ + "id": o.agentInfo.AgentID(), + }, + }, + }, { "copy_fields": map[string]interface{}{ "fields": []map[string]interface{}{ @@ -571,16 +601,6 @@ func (o *Operator) getMonitoringMetricbeatConfig(outputType string, output inter "output": map[string]interface{}{ outputType: output, }, - "processors": []map[string]interface{}{ - { - "add_fields": map[string]interface{}{ - "target": "agent", - "fields": map[string]interface{}{ - "id": o.agentInfo.AgentID(), - }, - }, - }, - }, } return result, true