From dca69893bddb34934831082678fcb4a3d84ce0a3 Mon Sep 17 00:00:00 2001 From: Dominik Rosiek Date: Fri, 5 Jul 2024 11:46:13 +0200 Subject: [PATCH] chore: fix keeping time attribute Signed-off-by: Dominik Rosiek --- .../conf/logs/collector/common/filelog_receiver.yaml | 7 +++++-- tests/helm/testdata/goldenfile/logs_otc/basic.output.yaml | 5 ++++- tests/helm/testdata/goldenfile/logs_otc/debug.output.yaml | 5 ++++- .../logs_otc_daemonset/multiple_multiline.output.yaml | 5 ++++- .../logs_otc_windows/configmap/basic.output.yaml | 5 ++++- .../logs_otc_windows/configmap/debug.output.yaml | 5 ++++- .../daemonset/multiple_multiline.output.yaml | 5 ++++- 7 files changed, 29 insertions(+), 8 deletions(-) diff --git a/deploy/helm/sumologic/conf/logs/collector/common/filelog_receiver.yaml b/deploy/helm/sumologic/conf/logs/collector/common/filelog_receiver.yaml index e310d79bc..5fd71084f 100644 --- a/deploy/helm/sumologic/conf/logs/collector/common/filelog_receiver.yaml +++ b/deploy/helm/sumologic/conf/logs/collector/common/filelog_receiver.yaml @@ -49,6 +49,9 @@ filelog/containers: - type: move from: resource["log.iostream"] to: resource["stream"] + - type: move + from: resource["time"] + to: attributes["time"] ## Keep only the following attributes: ## - stream ## - k8s.pod.name @@ -63,9 +66,9 @@ filelog/containers: - resource["k8s.pod.name"] - resource["k8s.container.name"] - resource["k8s.namespace.name"] - - resource["log.file.path"] + - attributes["log.file.path"] {{ if .Values.sumologic.logs.container.keep_time_attribute }} - - resource["time"] + - attributes["time"] {{ end }} ## Strip trailing "\n" from the log body diff --git a/tests/helm/testdata/goldenfile/logs_otc/basic.output.yaml b/tests/helm/testdata/goldenfile/logs_otc/basic.output.yaml index 0586da5a8..f7d74312e 100644 --- a/tests/helm/testdata/goldenfile/logs_otc/basic.output.yaml +++ b/tests/helm/testdata/goldenfile/logs_otc/basic.output.yaml @@ -67,12 +67,15 @@ data: - from: resource["log.iostream"] to: resource["stream"] type: move + - from: resource["time"] + to: attributes["time"] + type: move - fields: - resource["stream"] - resource["k8s.pod.name"] - resource["k8s.container.name"] - resource["k8s.namespace.name"] - - resource["log.file.path"] + - attributes["log.file.path"] id: keep-fields type: retain - default: multiline diff --git a/tests/helm/testdata/goldenfile/logs_otc/debug.output.yaml b/tests/helm/testdata/goldenfile/logs_otc/debug.output.yaml index d3ca1d2bb..3e3e30514 100644 --- a/tests/helm/testdata/goldenfile/logs_otc/debug.output.yaml +++ b/tests/helm/testdata/goldenfile/logs_otc/debug.output.yaml @@ -77,12 +77,15 @@ data: - from: resource["log.iostream"] to: resource["stream"] type: move + - from: resource["time"] + to: attributes["time"] + type: move - fields: - resource["stream"] - resource["k8s.pod.name"] - resource["k8s.container.name"] - resource["k8s.namespace.name"] - - resource["log.file.path"] + - attributes["log.file.path"] id: keep-fields type: retain - default: multiline diff --git a/tests/helm/testdata/goldenfile/logs_otc_daemonset/multiple_multiline.output.yaml b/tests/helm/testdata/goldenfile/logs_otc_daemonset/multiple_multiline.output.yaml index 2bd73477d..53648f81b 100644 --- a/tests/helm/testdata/goldenfile/logs_otc_daemonset/multiple_multiline.output.yaml +++ b/tests/helm/testdata/goldenfile/logs_otc_daemonset/multiple_multiline.output.yaml @@ -67,12 +67,15 @@ data: - from: resource["log.iostream"] to: resource["stream"] type: move + - from: resource["time"] + to: attributes["time"] + type: move - fields: - resource["stream"] - resource["k8s.pod.name"] - resource["k8s.container.name"] - resource["k8s.namespace.name"] - - resource["log.file.path"] + - attributes["log.file.path"] id: keep-fields type: retain - default: multiline diff --git a/tests/helm/testdata/goldenfile/logs_otc_windows/configmap/basic.output.yaml b/tests/helm/testdata/goldenfile/logs_otc_windows/configmap/basic.output.yaml index cc0d59bda..bf690e944 100644 --- a/tests/helm/testdata/goldenfile/logs_otc_windows/configmap/basic.output.yaml +++ b/tests/helm/testdata/goldenfile/logs_otc_windows/configmap/basic.output.yaml @@ -46,12 +46,15 @@ data: - from: resource["log.iostream"] to: resource["stream"] type: move + - from: resource["time"] + to: attributes["time"] + type: move - fields: - resource["stream"] - resource["k8s.pod.name"] - resource["k8s.container.name"] - resource["k8s.namespace.name"] - - resource["log.file.path"] + - attributes["log.file.path"] id: keep-fields type: retain - default: multiline diff --git a/tests/helm/testdata/goldenfile/logs_otc_windows/configmap/debug.output.yaml b/tests/helm/testdata/goldenfile/logs_otc_windows/configmap/debug.output.yaml index e8b4ff533..75a053651 100644 --- a/tests/helm/testdata/goldenfile/logs_otc_windows/configmap/debug.output.yaml +++ b/tests/helm/testdata/goldenfile/logs_otc_windows/configmap/debug.output.yaml @@ -57,12 +57,15 @@ data: - from: resource["log.iostream"] to: resource["stream"] type: move + - from: resource["time"] + to: attributes["time"] + type: move - fields: - resource["stream"] - resource["k8s.pod.name"] - resource["k8s.container.name"] - resource["k8s.namespace.name"] - - resource["log.file.path"] + - attributes["log.file.path"] id: keep-fields type: retain - default: multiline diff --git a/tests/helm/testdata/goldenfile/logs_otc_windows/daemonset/multiple_multiline.output.yaml b/tests/helm/testdata/goldenfile/logs_otc_windows/daemonset/multiple_multiline.output.yaml index 31ca7f7a6..54f8a01a6 100644 --- a/tests/helm/testdata/goldenfile/logs_otc_windows/daemonset/multiple_multiline.output.yaml +++ b/tests/helm/testdata/goldenfile/logs_otc_windows/daemonset/multiple_multiline.output.yaml @@ -46,12 +46,15 @@ data: - from: resource["log.iostream"] to: resource["stream"] type: move + - from: resource["time"] + to: attributes["time"] + type: move - fields: - resource["stream"] - resource["k8s.pod.name"] - resource["k8s.container.name"] - resource["k8s.namespace.name"] - - resource["log.file.path"] + - attributes["log.file.path"] id: keep-fields type: retain - default: multiline