Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions x-pack/elastic-agent/CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,4 @@
- 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]
2 changes: 1 addition & 1 deletion x-pack/elastic-agent/pkg/agent/program/supported.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ filebeat:
id: agent-id
version: 8.0.0
snapshot: false
- add_fields:
target: "agent"
fields:
id: agent-id
output:
elasticsearch:
enabled: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ filebeat:
id: agent-id
version: 8.0.0
snapshot: false
- add_fields:
target: "agent"
fields:
id: agent-id
output:
elasticsearch:
hosts:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ filebeat:
id: agent-id
version: 8.0.0
snapshot: false
- add_fields:
target: "agent"
fields:
id: agent-id
- type: log
paths:
- /var/log/hello3.log
Expand All @@ -48,6 +52,10 @@ filebeat:
id: agent-id
version: 8.0.0
snapshot: false
- add_fields:
target: "agent"
fields:
id: agent-id
output:
elasticsearch:
hosts:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ inputs:
timeout: 16s
wait: 1s
data_stream.namespace: default
processors:
- add_fields:
target: 'elastic_agent'
fields:
id: agent-id
version: 8.0.0
snapshot: false
- add_fields:
target: 'agent'
fields:
id: agent-id
output:
elasticsearch:
hosts:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ metricbeat:
id: agent-id
version: 8.0.0
snapshot: false
- add_fields:
target: "agent"
fields:
id: agent-id
- module: docker
metricsets: [info]
index: metrics-generic-default
Expand All @@ -42,6 +46,10 @@ metricbeat:
id: agent-id
version: 8.0.0
snapshot: false
- add_fields:
target: "agent"
fields:
id: agent-id
- module: apache
metricsets: [info]
index: metrics-generic-testing
Expand All @@ -66,6 +74,10 @@ metricbeat:
id: agent-id
version: 8.0.0
snapshot: false
- add_fields:
target: "agent"
fields:
id: agent-id
output:
elasticsearch:
hosts: [127.0.0.1:9200, 127.0.0.1:9300]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ inputs:
id: agent-id
version: 8.0.0
snapshot: false
- add_fields:
target: 'agent'
fields:
id: agent-id
streams:
- type: flow
timeout: 10s
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@ inputs:
timeout: 16s
wait: 1s
data_stream.namespace: default
processors:
- add_fields:
target: 'elastic_agent'
fields:
id: agent-id
version: 8.0.0
snapshot: false
- add_fields:
target: 'agent'
fields:
id: agent-id
- type: synthetics/tcp
id: unique-tcp-id
name: my-tcp
Expand All @@ -15,6 +26,17 @@ inputs:
timeout: 16s
wait: 1s
data_stream.namespace: default
processors:
- add_fields:
target: 'elastic_agent'
fields:
id: agent-id
version: 8.0.0
snapshot: false
- add_fields:
target: 'agent'
fields:
id: agent-id
- type: synthetics/icmp
id: unique-icmp-id
name: my-icmp
Expand All @@ -26,6 +48,17 @@ inputs:
timeout: 16s
wait: 1s
data_stream.namespace: default
processors:
- add_fields:
target: 'elastic_agent'
fields:
id: agent-id
version: 8.0.0
snapshot: false
- add_fields:
target: 'agent'
fields:
id: agent-id
output:
elasticsearch:
hosts: [127.0.0.1:9200, 127.0.0.1:9300]
Expand Down
11 changes: 10 additions & 1 deletion x-pack/elastic-agent/pkg/agent/transpiler/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ func (r *InjectAgentInfoRule) Apply(agentInfo AgentInfo, ast *AST) (err error) {
return errors.New("InjectAgentInfoRule: processors is not a list")
}

// elastic.agent
// elastic_agent
processorMap := &Dict{value: make([]Node, 0)}
processorMap.value = append(processorMap.value, &Key{name: "target", value: &StrVal{value: "elastic_agent"}})
processorMap.value = append(processorMap.value, &Key{name: "fields", value: &Dict{value: []Node{
Expand All @@ -785,6 +785,15 @@ func (r *InjectAgentInfoRule) Apply(agentInfo AgentInfo, ast *AST) (err error) {
}}})
addFieldsMap := &Dict{value: []Node{&Key{"add_fields", processorMap}}}
processorsList.value = mergeStrategy("").InjectItem(processorsList.value, addFieldsMap)

// agent.id
processorMap = &Dict{value: make([]Node, 0)}
processorMap.value = append(processorMap.value, &Key{name: "target", value: &StrVal{value: "agent"}})
processorMap.value = append(processorMap.value, &Key{name: "fields", value: &Dict{value: []Node{
&Key{name: "id", value: &StrVal{value: agentInfo.AgentID()}},
}}})
addFieldsMap = &Dict{value: []Node{&Key{"add_fields", processorMap}}}
processorsList.value = mergeStrategy("").InjectItem(processorsList.value, addFieldsMap)
}

return nil
Expand Down
8 changes: 8 additions & 0 deletions x-pack/elastic-agent/pkg/agent/transpiler/rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ inputs:
id: agent-id
snapshot: false
version: 8.0.0
- add_fields:
target: agent
fields:
id: agent-id
- name: With processors
type: file
processors:
Expand All @@ -202,6 +206,10 @@ inputs:
id: agent-id
snapshot: false
version: 8.0.0
- add_fields:
target: agent
fields:
id: agent-id
`,
rule: &RuleList{
Rules: []Rule{
Expand Down
1 change: 1 addition & 0 deletions x-pack/elastic-agent/spec/heartbeat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ rules:
key: enabled
values:
- true
- inject_agent_info: {}
- filter:
selectors:
- inputs
Expand Down