From 0c1879a03214d76984b42096cf0a60758d0a917d Mon Sep 17 00:00:00 2001 From: Panos Koutsovasilis Date: Tue, 29 Oct 2024 17:57:02 +0200 Subject: [PATCH] fix: add back processors --- .../examples/eck/rendered/manifest.yaml | 37 ++++++++++++++++++ .../kubernetes-default/rendered/manifest.yaml | 39 ++++++++++++++++++- .../rendered/manifest.yaml | 39 ++++++++++++++++++- .../rendered/manifest.yaml | 39 ++++++++++++++++++- .../rendered/manifest.yaml | 39 ++++++++++++++++++- .../_kubernetes_logs_containers.tpl | 39 ++++++++++++++++++- deploy/helm/elastic-agent/values.schema.json | 2 +- 7 files changed, 228 insertions(+), 6 deletions(-) diff --git a/deploy/helm/elastic-agent/examples/eck/rendered/manifest.yaml b/deploy/helm/elastic-agent/examples/eck/rendered/manifest.yaml index 1dcda01f6b6..7a3e94ba822 100644 --- a/deploy/helm/elastic-agent/examples/eck/rendered/manifest.yaml +++ b/deploy/helm/elastic-agent/examples/eck/rendered/manifest.yaml @@ -432,6 +432,43 @@ stringData: stream: all paths: - /var/log/containers/*${kubernetes.container.id}.log + processors: + - add_fields: + fields: + annotations.elastic_co/dataset: ${kubernetes.annotations.elastic.co/dataset|""} + annotations.elastic_co/namespace: ${kubernetes.annotations.elastic.co/namespace|""} + annotations.elastic_co/preserve_original_event: ${kubernetes.annotations.elastic.co/preserve_original_event|""} + target: kubernetes + - drop_fields: + fields: + - kubernetes.annotations.elastic_co/dataset + ignore_missing: true + when: + equals: + kubernetes.annotations.elastic_co/dataset: "" + - drop_fields: + fields: + - kubernetes.annotations.elastic_co/namespace + ignore_missing: true + when: + equals: + kubernetes.annotations.elastic_co/namespace: "" + - drop_fields: + fields: + - kubernetes.annotations.elastic_co/preserve_original_event + ignore_missing: true + when: + equals: + kubernetes.annotations.elastic_co/preserve_original_event: "" + - add_tags: + tags: + - preserve_original_event + when: + and: + - has_fields: + - kubernetes.annotations.elastic_co/preserve_original_event + - regexp: + kubernetes.annotations.elastic_co/preserve_original_event: ^(?i)true$ prospector.scanner.symlinks: true type: filestream use_output: default diff --git a/deploy/helm/elastic-agent/examples/kubernetes-default/rendered/manifest.yaml b/deploy/helm/elastic-agent/examples/kubernetes-default/rendered/manifest.yaml index 3d7ec26cdd3..16385331e34 100644 --- a/deploy/helm/elastic-agent/examples/kubernetes-default/rendered/manifest.yaml +++ b/deploy/helm/elastic-agent/examples/kubernetes-default/rendered/manifest.yaml @@ -441,6 +441,43 @@ stringData: stream: all paths: - /var/log/containers/*${kubernetes.container.id}.log + processors: + - add_fields: + fields: + annotations.elastic_co/dataset: ${kubernetes.annotations.elastic.co/dataset|""} + annotations.elastic_co/namespace: ${kubernetes.annotations.elastic.co/namespace|""} + annotations.elastic_co/preserve_original_event: ${kubernetes.annotations.elastic.co/preserve_original_event|""} + target: kubernetes + - drop_fields: + fields: + - kubernetes.annotations.elastic_co/dataset + ignore_missing: true + when: + equals: + kubernetes.annotations.elastic_co/dataset: "" + - drop_fields: + fields: + - kubernetes.annotations.elastic_co/namespace + ignore_missing: true + when: + equals: + kubernetes.annotations.elastic_co/namespace: "" + - drop_fields: + fields: + - kubernetes.annotations.elastic_co/preserve_original_event + ignore_missing: true + when: + equals: + kubernetes.annotations.elastic_co/preserve_original_event: "" + - add_tags: + tags: + - preserve_original_event + when: + and: + - has_fields: + - kubernetes.annotations.elastic_co/preserve_original_event + - regexp: + kubernetes.annotations.elastic_co/preserve_original_event: ^(?i)true$ prospector.scanner.symlinks: true type: filestream use_output: default @@ -1052,7 +1089,7 @@ spec: labels: name: agent-pernode-example annotations: - checksum/config: 6f17f113f90d08acea46c377cf6542336fba6948fc65d31f67530d80a965bb3f + checksum/config: 53aa4ccc3e8557125fecf738e70722e2aaa1199ee79a823f684a9d4a296af7b0 spec: dnsPolicy: ClusterFirstWithHostNet diff --git a/deploy/helm/elastic-agent/examples/kubernetes-hints-autodiscover/rendered/manifest.yaml b/deploy/helm/elastic-agent/examples/kubernetes-hints-autodiscover/rendered/manifest.yaml index 62f6ccdf485..8f7d94ec561 100644 --- a/deploy/helm/elastic-agent/examples/kubernetes-hints-autodiscover/rendered/manifest.yaml +++ b/deploy/helm/elastic-agent/examples/kubernetes-hints-autodiscover/rendered/manifest.yaml @@ -443,6 +443,43 @@ stringData: stream: all paths: - /var/log/containers/*${kubernetes.container.id}.log + processors: + - add_fields: + fields: + annotations.elastic_co/dataset: ${kubernetes.annotations.elastic.co/dataset|""} + annotations.elastic_co/namespace: ${kubernetes.annotations.elastic.co/namespace|""} + annotations.elastic_co/preserve_original_event: ${kubernetes.annotations.elastic.co/preserve_original_event|""} + target: kubernetes + - drop_fields: + fields: + - kubernetes.annotations.elastic_co/dataset + ignore_missing: true + when: + equals: + kubernetes.annotations.elastic_co/dataset: "" + - drop_fields: + fields: + - kubernetes.annotations.elastic_co/namespace + ignore_missing: true + when: + equals: + kubernetes.annotations.elastic_co/namespace: "" + - drop_fields: + fields: + - kubernetes.annotations.elastic_co/preserve_original_event + ignore_missing: true + when: + equals: + kubernetes.annotations.elastic_co/preserve_original_event: "" + - add_tags: + tags: + - preserve_original_event + when: + and: + - has_fields: + - kubernetes.annotations.elastic_co/preserve_original_event + - regexp: + kubernetes.annotations.elastic_co/preserve_original_event: ^(?i)true$ prospector.scanner.symlinks: true type: filestream use_output: default @@ -1054,7 +1091,7 @@ spec: labels: name: agent-pernode-example annotations: - checksum/config: a0992804c5782a0f4c3b4eeae610ff3d222fc7f3e219658cf9787fbe4e5202f1 + checksum/config: 21fb7e317577410096de8d8e0fb03b32ad2e406b549f75085ae6907d38678e46 spec: dnsPolicy: ClusterFirstWithHostNet diff --git a/deploy/helm/elastic-agent/examples/kubernetes-only-logs/rendered/manifest.yaml b/deploy/helm/elastic-agent/examples/kubernetes-only-logs/rendered/manifest.yaml index f189770e828..c3a3966facf 100644 --- a/deploy/helm/elastic-agent/examples/kubernetes-only-logs/rendered/manifest.yaml +++ b/deploy/helm/elastic-agent/examples/kubernetes-only-logs/rendered/manifest.yaml @@ -64,6 +64,43 @@ stringData: stream: all paths: - /var/log/containers/*${kubernetes.container.id}.log + processors: + - add_fields: + fields: + annotations.elastic_co/dataset: ${kubernetes.annotations.elastic.co/dataset|""} + annotations.elastic_co/namespace: ${kubernetes.annotations.elastic.co/namespace|""} + annotations.elastic_co/preserve_original_event: ${kubernetes.annotations.elastic.co/preserve_original_event|""} + target: kubernetes + - drop_fields: + fields: + - kubernetes.annotations.elastic_co/dataset + ignore_missing: true + when: + equals: + kubernetes.annotations.elastic_co/dataset: "" + - drop_fields: + fields: + - kubernetes.annotations.elastic_co/namespace + ignore_missing: true + when: + equals: + kubernetes.annotations.elastic_co/namespace: "" + - drop_fields: + fields: + - kubernetes.annotations.elastic_co/preserve_original_event + ignore_missing: true + when: + equals: + kubernetes.annotations.elastic_co/preserve_original_event: "" + - add_tags: + tags: + - preserve_original_event + when: + and: + - has_fields: + - kubernetes.annotations.elastic_co/preserve_original_event + - regexp: + kubernetes.annotations.elastic_co/preserve_original_event: ^(?i)true$ prospector.scanner.symlinks: true type: filestream use_output: default @@ -190,7 +227,7 @@ spec: labels: name: agent-pernode-example annotations: - checksum/config: eccba05d4529b7e88754b86e1d7f671436f99a9968e0df202730569e2bd31816 + checksum/config: 4de2216224a483ae1355aeec668894f764edc48bd3481d8fbc65f67eedc1b336 spec: dnsPolicy: ClusterFirstWithHostNet diff --git a/deploy/helm/elastic-agent/examples/multiple-integrations/rendered/manifest.yaml b/deploy/helm/elastic-agent/examples/multiple-integrations/rendered/manifest.yaml index 5a2f5c2e75f..5f16fc5d56d 100644 --- a/deploy/helm/elastic-agent/examples/multiple-integrations/rendered/manifest.yaml +++ b/deploy/helm/elastic-agent/examples/multiple-integrations/rendered/manifest.yaml @@ -469,6 +469,43 @@ stringData: stream: all paths: - /var/log/containers/*${kubernetes.container.id}.log + processors: + - add_fields: + fields: + annotations.elastic_co/dataset: ${kubernetes.annotations.elastic.co/dataset|""} + annotations.elastic_co/namespace: ${kubernetes.annotations.elastic.co/namespace|""} + annotations.elastic_co/preserve_original_event: ${kubernetes.annotations.elastic.co/preserve_original_event|""} + target: kubernetes + - drop_fields: + fields: + - kubernetes.annotations.elastic_co/dataset + ignore_missing: true + when: + equals: + kubernetes.annotations.elastic_co/dataset: "" + - drop_fields: + fields: + - kubernetes.annotations.elastic_co/namespace + ignore_missing: true + when: + equals: + kubernetes.annotations.elastic_co/namespace: "" + - drop_fields: + fields: + - kubernetes.annotations.elastic_co/preserve_original_event + ignore_missing: true + when: + equals: + kubernetes.annotations.elastic_co/preserve_original_event: "" + - add_tags: + tags: + - preserve_original_event + when: + and: + - has_fields: + - kubernetes.annotations.elastic_co/preserve_original_event + - regexp: + kubernetes.annotations.elastic_co/preserve_original_event: ^(?i)true$ prospector.scanner.symlinks: true type: filestream use_output: default @@ -1080,7 +1117,7 @@ spec: labels: name: agent-pernode-example annotations: - checksum/config: a0992804c5782a0f4c3b4eeae610ff3d222fc7f3e219658cf9787fbe4e5202f1 + checksum/config: 21fb7e317577410096de8d8e0fb03b32ad2e406b549f75085ae6907d38678e46 spec: dnsPolicy: ClusterFirstWithHostNet diff --git a/deploy/helm/elastic-agent/templates/integrations/_kubernetes/_kubernetes_logs_containers.tpl b/deploy/helm/elastic-agent/templates/integrations/_kubernetes/_kubernetes_logs_containers.tpl index dbc23247eae..55571edd729 100644 --- a/deploy/helm/elastic-agent/templates/integrations/_kubernetes/_kubernetes_logs_containers.tpl +++ b/deploy/helm/elastic-agent/templates/integrations/_kubernetes/_kubernetes_logs_containers.tpl @@ -29,6 +29,43 @@ Config input for container logs stream: {{ dig "vars" "stream" "all" .Values.kubernetes.containers.logs }} format: {{ dig "vars" "format" "auto" .Values.kubernetes.containers.logs }} {{- with $.Values.kubernetes.containers.logs.additionalParsersConfig }} - {{- . | toYaml | nindent 6 }} + {{ . | toYaml | nindent 6 }} {{- end }} + processors: + - add_fields: + target: kubernetes + fields: + annotations.elastic_co/dataset: '${kubernetes.annotations.elastic.co/dataset|""}' + annotations.elastic_co/namespace: '${kubernetes.annotations.elastic.co/namespace|""}' + annotations.elastic_co/preserve_original_event: '${kubernetes.annotations.elastic.co/preserve_original_event|""}' + - drop_fields: + fields: + - kubernetes.annotations.elastic_co/dataset + when: + equals: + kubernetes.annotations.elastic_co/dataset: '' + ignore_missing: true + - drop_fields: + fields: + - kubernetes.annotations.elastic_co/namespace + when: + equals: + kubernetes.annotations.elastic_co/namespace: '' + ignore_missing: true + - drop_fields: + fields: + - kubernetes.annotations.elastic_co/preserve_original_event + when: + equals: + kubernetes.annotations.elastic_co/preserve_original_event: '' + ignore_missing: true + - add_tags: + tags: + - preserve_original_event + when: + and: + - has_fields: + - kubernetes.annotations.elastic_co/preserve_original_event + - regexp: + kubernetes.annotations.elastic_co/preserve_original_event: ^(?i)true$ {{- end -}} diff --git a/deploy/helm/elastic-agent/values.schema.json b/deploy/helm/elastic-agent/values.schema.json index 443c5fc8653..1223e7c1662 100644 --- a/deploy/helm/elastic-agent/values.schema.json +++ b/deploy/helm/elastic-agent/values.schema.json @@ -186,7 +186,7 @@ "additionalParsersConfig": { "type": "array", "items": { - "type": "string" + "type": "object" } } },