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

[Elastic-Agent] Moved stream.* fields to top of event #17858

Merged
merged 6 commits into from
Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from 4 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.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- Fixed process spawning on Windows {pull}17751[17751]
- Fixed injected log path to monitoring beat {pull}17833[17833]
- Make sure that the Elastic Agent connect over TLS in cloud. {pull}xx[xxx]
- Moved stream.* fields to top of event {pull}17858[17858]

==== New features

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ filebeat:
index: logs-generic-default
processors:
- add_fields:
target: "stream"
fields:
stream.type: logs
stream.dataset: generic
stream.namespace: default
type: logs
dataset: generic
namespace: default
output:
elasticsearch:
hosts:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ filebeat:
index: logs-generic-default
processors:
- add_fields:
target: "stream"
fields:
stream.type: logs
stream.dataset: generic
stream.namespace: default
type: logs
dataset: generic
namespace: default
output:
elasticsearch:
enabled: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ filebeat:
index: logs-generic-default
processors:
- add_fields:
target: "stream"
fields:
stream.type: logs
stream.dataset: generic
stream.namespace: default
type: logs
dataset: generic
namespace: default
output:
elasticsearch:
hosts:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@ filebeat:
var: value
processors:
- add_fields:
target: "stream"
fields:
stream.type: logs
stream.dataset: generic
stream.namespace: default
type: logs
dataset: generic
namespace: default
output:
elasticsearch:
hosts:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ metricbeat:
hosts: ["http://127.0.0.1:8080"]
processors:
- add_fields:
target: "stream"
fields:
stream.type: metrics
stream.dataset: docker.status
stream.namespace: default
type: metrics
dataset: docker.status
namespace: default
- module: apache
metricsets: [info]
index: metrics-generic-testing
Expand All @@ -19,10 +20,11 @@ metricbeat:
fields:
should_be: first
- add_fields:
target: "stream"
fields:
stream.type: metrics
stream.dataset: generic
stream.namespace: testing
type: metrics
dataset: generic
namespace: testing
output:
elasticsearch:
hosts: [127.0.0.1:9200, 127.0.0.1:9300]
Expand Down
7 changes: 4 additions & 3 deletions x-pack/elastic-agent/pkg/agent/transpiler/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,10 +523,11 @@ func (r *InjectStreamProcessorRule) Apply(ast *AST) error {
}

processorMap := &Dict{value: make([]Node, 0)}
processorMap.value = append(processorMap.value, &Key{name: "target", value: &StrVal{value: "stream"}})
processorMap.value = append(processorMap.value, &Key{name: "fields", value: &Dict{value: []Node{
&Key{name: "stream.type", value: &StrVal{value: r.Type}},
&Key{name: "stream.namespace", value: &StrVal{value: namespace}},
&Key{name: "stream.dataset", value: &StrVal{value: dataset}},
&Key{name: "type", value: &StrVal{value: r.Type}},
&Key{name: "namespace", value: &StrVal{value: namespace}},
&Key{name: "dataset", value: &StrVal{value: dataset}},
}}})

addFieldsMap := &Dict{value: []Node{&Key{"add_fields", processorMap}}}
Expand Down