From f6818bad5331bd08193fbe0e3bbf38da4ee1133e Mon Sep 17 00:00:00 2001 From: Michal Pristas Date: Tue, 21 Apr 2020 11:51:21 +0200 Subject: [PATCH 1/4] moved to top --- x-pack/elastic-agent/pkg/agent/transpiler/rules.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/x-pack/elastic-agent/pkg/agent/transpiler/rules.go b/x-pack/elastic-agent/pkg/agent/transpiler/rules.go index 286c162bc0d9..1b6a2c56cab3 100644 --- a/x-pack/elastic-agent/pkg/agent/transpiler/rules.go +++ b/x-pack/elastic-agent/pkg/agent/transpiler/rules.go @@ -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}}} From b4b307243a95242c36d455cf6abc3ee6bd86a8b4 Mon Sep 17 00:00:00 2001 From: Michal Pristas Date: Tue, 21 Apr 2020 11:53:59 +0200 Subject: [PATCH 2/4] changelog --- x-pack/elastic-agent/CHANGELOG.asciidoc | 1 + 1 file changed, 1 insertion(+) diff --git a/x-pack/elastic-agent/CHANGELOG.asciidoc b/x-pack/elastic-agent/CHANGELOG.asciidoc index e178ffe3e8b5..b14e5bf1a38a 100644 --- a/x-pack/elastic-agent/CHANGELOG.asciidoc +++ b/x-pack/elastic-agent/CHANGELOG.asciidoc @@ -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 From eb0d6607d73e80895c7cd80647a5a3fb4a10d59e Mon Sep 17 00:00:00 2001 From: Michal Pristas Date: Tue, 21 Apr 2020 13:56:08 +0200 Subject: [PATCH 3/4] tests updated --- go.sum | 1 + .../testdata/constraints_config-filebeat.yml | 7 ++++--- .../testdata/enabled_output_true-filebeat.yml | 7 ++++--- .../program/testdata/enabled_true-filebeat.yml | 7 ++++--- .../program/testdata/single_config-filebeat.yml | 7 ++++--- .../program/testdata/single_config-metricbeat.yml | 14 ++++++++------ 6 files changed, 25 insertions(+), 18 deletions(-) diff --git a/go.sum b/go.sum index 5c8338626ccf..5c6ef5967250 100644 --- a/go.sum +++ b/go.sum @@ -217,6 +217,7 @@ github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/eclipse/paho.mqtt.golang v1.2.1-0.20200121105743-0d940dd29fd2 h1:DW6WrARxK5J+o8uAKCiACi5wy9EK1UzrsCpGBPsKHAA= github.com/eclipse/paho.mqtt.golang v1.2.1-0.20200121105743-0d940dd29fd2/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= +github.com/elastic/beats v7.6.2+incompatible h1:jHdLv83KURaqWUC6f55iMyVP6LYZrgElfeqxKWcskVE= github.com/elastic/dhcp v0.0.0-20200227161230-57ec251c7eb3 h1:lnDkqiRFKm0rxdljqrj3lotWinO9+jFmeDXIC4gvIQs= github.com/elastic/dhcp v0.0.0-20200227161230-57ec251c7eb3/go.mod h1:aPqzac6AYkipvp4hufTyMj5PDIphF3+At8zr7r51xjY= github.com/elastic/ecs v1.5.0 h1:/VEIBsRU4ecq2+U3RPfKNc6bFyomP6qnthYEcQZu8GU= diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/constraints_config-filebeat.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/constraints_config-filebeat.yml index c19f9c366299..20e08dbdd7ed 100644 --- a/x-pack/elastic-agent/pkg/agent/program/testdata/constraints_config-filebeat.yml +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/constraints_config-filebeat.yml @@ -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: diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/enabled_output_true-filebeat.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/enabled_output_true-filebeat.yml index 413a6866e91d..26d5dfdca2f7 100644 --- a/x-pack/elastic-agent/pkg/agent/program/testdata/enabled_output_true-filebeat.yml +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/enabled_output_true-filebeat.yml @@ -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 diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/enabled_true-filebeat.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/enabled_true-filebeat.yml index a31fe4e37ddc..feac81692f76 100644 --- a/x-pack/elastic-agent/pkg/agent/program/testdata/enabled_true-filebeat.yml +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/enabled_true-filebeat.yml @@ -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: diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/single_config-filebeat.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/single_config-filebeat.yml index 39c54159d102..54604b76801c 100644 --- a/x-pack/elastic-agent/pkg/agent/program/testdata/single_config-filebeat.yml +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/single_config-filebeat.yml @@ -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: diff --git a/x-pack/elastic-agent/pkg/agent/program/testdata/single_config-metricbeat.yml b/x-pack/elastic-agent/pkg/agent/program/testdata/single_config-metricbeat.yml index 056233819f35..6342d2b54260 100644 --- a/x-pack/elastic-agent/pkg/agent/program/testdata/single_config-metricbeat.yml +++ b/x-pack/elastic-agent/pkg/agent/program/testdata/single_config-metricbeat.yml @@ -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 @@ -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] From 68f244b35d1ba188bc8a13adabf3cfe887f2f7b0 Mon Sep 17 00:00:00 2001 From: Michal Pristas Date: Tue, 21 Apr 2020 14:59:57 +0200 Subject: [PATCH 4/4] go mod --- go.sum | 1 - 1 file changed, 1 deletion(-) diff --git a/go.sum b/go.sum index 5c6ef5967250..5c8338626ccf 100644 --- a/go.sum +++ b/go.sum @@ -217,7 +217,6 @@ github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/eclipse/paho.mqtt.golang v1.2.1-0.20200121105743-0d940dd29fd2 h1:DW6WrARxK5J+o8uAKCiACi5wy9EK1UzrsCpGBPsKHAA= github.com/eclipse/paho.mqtt.golang v1.2.1-0.20200121105743-0d940dd29fd2/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= -github.com/elastic/beats v7.6.2+incompatible h1:jHdLv83KURaqWUC6f55iMyVP6LYZrgElfeqxKWcskVE= github.com/elastic/dhcp v0.0.0-20200227161230-57ec251c7eb3 h1:lnDkqiRFKm0rxdljqrj3lotWinO9+jFmeDXIC4gvIQs= github.com/elastic/dhcp v0.0.0-20200227161230-57ec251c7eb3/go.mod h1:aPqzac6AYkipvp4hufTyMj5PDIphF3+At8zr7r51xjY= github.com/elastic/ecs v1.5.0 h1:/VEIBsRU4ecq2+U3RPfKNc6bFyomP6qnthYEcQZu8GU=