Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set agent.id to Fleet Agent ID for each metric/log monitoring input #26776

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 40 additions & 20 deletions x-pack/elastic-agent/pkg/agent/operation/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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{
Expand All @@ -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
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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{}{
Expand Down Expand Up @@ -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{}{
Expand Down Expand Up @@ -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
Expand Down