Skip to content

Commit

Permalink
Add Fleet agent.id to Agent monitoring data (#26548)
Browse files Browse the repository at this point in the history
This is a follow up to #26394 which set the agent.id field to the Fleet agent ID for
for integrations that are run by Agent, but that didn't cover the Filebeat and Metricbeat
processes that are executed by Agent for monitoring itself. This covers those processes.

Relates #26394

(cherry picked from commit 7b66597)
  • Loading branch information
andrewkroh authored and mergify-bot committed Jun 29, 2021
1 parent 5d2baaa commit c2f65cc
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
2 changes: 2 additions & 0 deletions x-pack/elastic-agent/CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,7 @@
- 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]
- Add proxy support to artifact downloader and communication with fleet server. {pull}25219[25219]
- Enable configuring monitoring namespace {issue}26439[26439]
- Communicate with Fleet Server over HTTP2. {pull}26474[26474]
20 changes: 20 additions & 0 deletions x-pack/elastic-agent/pkg/agent/operation/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit c2f65cc

Please sign in to comment.