diff --git a/x-pack/elastic-agent/CHANGELOG.next.asciidoc b/x-pack/elastic-agent/CHANGELOG.next.asciidoc index ee61d98a3189..83691ac62318 100644 --- a/x-pack/elastic-agent/CHANGELOG.next.asciidoc +++ b/x-pack/elastic-agent/CHANGELOG.next.asciidoc @@ -115,6 +115,6 @@ - Log output of container to $LOGS_PATH/elastic-agent-start.log when LOGS_PATH set {pull}25150[25150] - Use `filestream` input for internal log collection. {pull}25660[25660] - Enable agent to send custom headers to kibana/ES {pull}26275[26275] -- Set `agent.id` to the Fleet Agent ID in events published from inputs backed by Beats. {issue}21121[21121] {pull}26394[26394] +- Set `agent.id` to the Fleet Agent ID in events published from inputs backed by Beats. {issue}21121[21121] {pull}26394[26394] {pull}26548[26548] - Enable configuring monitoring namespace {issue}26439[26439] - Communicate with Fleet Server over HTTP2. {pull}26474[26474] diff --git a/x-pack/elastic-agent/pkg/agent/operation/monitoring.go b/x-pack/elastic-agent/pkg/agent/operation/monitoring.go index 17188321b565..4712759ab70c 100644 --- a/x-pack/elastic-agent/pkg/agent/operation/monitoring.go +++ b/x-pack/elastic-agent/pkg/agent/operation/monitoring.go @@ -339,6 +339,16 @@ 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(), + }, + }, + }, + }, } o.logger.Debugf("monitoring configuration generated for filebeat: %v", result) @@ -563,6 +573,16 @@ 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(), + }, + }, + }, + }, } o.logger.Debugf("monitoring configuration generated for metricbeat: %v", result)