diff --git a/CHANGELOG.md b/CHANGELOG.md index b7aaf9e5a3..404aa27370 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased +### Added + +- Field name compatibility for SCK (#258) + ## [0.37.1] - 2021-11-01 ### Added diff --git a/helm-charts/splunk-otel-collector/templates/config/_common.tpl b/helm-charts/splunk-otel-collector/templates/config/_common.tpl index 609aefeceb..722e666e0f 100644 --- a/helm-charts/splunk-otel-collector/templates/config/_common.tpl +++ b/helm-charts/splunk-otel-collector/templates/config/_common.tpl @@ -101,6 +101,49 @@ resource/logs: - key: istio_service_name action: delete {{- end }} + {{- if .Values.splunkPlatform.fieldNameConvention.renameFieldsSck }} + - key: container_name + from_attribute: k8s.container.name + action: upsert + - key: cluster_name + from_attribute: k8s.cluster.name + action: upsert + - key: container_id + from_attribute: container.id + action: upsert + - key: pod + from_attribute: k8s.pod.name + action: upsert + - key: pod_uid + from_attribute: k8s.pod.uid + action: upsert + - key: namespace + from_attribute: k8s.namespace.name + action: upsert + {{- range $_, $label := .Values.extraAttributes.podLabels }} + - key: {{ printf "label_%s" $label }} + from_attribute: {{ printf "k8s.pod.labels.%s" $label }} + action: upsert + {{- end }} + {{- if not .Values.splunkPlatform.fieldNameConvention.keepOtelConvention }} + - key: k8s.container.name + action: delete + - key: k8s.cluster.name + action: delete + - key: container.id + action: delete + - key: k8s.pod.name + action: delete + - key: k8s.pod.uid + action: delete + - key: k8s.namespace.name + action: delete + {{- range $_, $label := .Values.extraAttributes.podLabels }} + - key: {{ printf "k8s.pod.labels.%s" $label }} + action: delete + {{- end }} + {{- end }} + {{- end }} {{- end }} {{/* diff --git a/helm-charts/splunk-otel-collector/templates/config/_otel-agent.tpl b/helm-charts/splunk-otel-collector/templates/config/_otel-agent.tpl index efcdc10430..4a99c84af1 100644 --- a/helm-charts/splunk-otel-collector/templates/config/_otel-agent.tpl +++ b/helm-charts/splunk-otel-collector/templates/config/_otel-agent.tpl @@ -436,9 +436,11 @@ service: - batch {{- if not .Values.otelCollector.enabled }} - filter/logs - - resource/logs {{- end }} - resource + {{- if not .Values.otelCollector.enabled }} + - resource/logs + {{- end }} - resourcedetection {{- if .Values.environment }} - resource/add_environment diff --git a/helm-charts/splunk-otel-collector/values.schema.json b/helm-charts/splunk-otel-collector/values.schema.json index 7daf17de1e..8b1063a511 100644 --- a/helm-charts/splunk-otel-collector/values.schema.json +++ b/helm-charts/splunk-otel-collector/values.schema.json @@ -76,6 +76,18 @@ "metricsEnabled": { "description": "Send Metrics to Splunk Platform", "type": "boolean" + }, + "fieldNameConvention": { + "type": "object", + "additionalProperties": false, + "properties": { + "renameFieldsSck": { + "type": "boolean" + }, + "keepOtelConvention": { + "type": "boolean" + } + } } }, "anyOf": [ diff --git a/helm-charts/splunk-otel-collector/values.yaml b/helm-charts/splunk-otel-collector/values.yaml index ffbc88c901..90ecd55352 100644 --- a/helm-charts/splunk-otel-collector/values.yaml +++ b/helm-charts/splunk-otel-collector/values.yaml @@ -67,6 +67,13 @@ splunkPlatform: logsEnabled: true metricsEnabled: true + # Field name conventions to use. (Only for those who are migrating from Splunk Connect for Kubernetes helm chart) + fieldNameConvention: + # Boolean for renaming pod metadata fields to match to Splunk Connect for Kubernetes helm chart. + renameFieldsSck: false + # Boolean for keeping Otel convention fields after renaming it + keepOtelConvention: true + ################################################################################ # Splunk Observability configuration ################################################################################ diff --git a/rendered/manifests/agent-only/configmap-otel-agent.yaml b/rendered/manifests/agent-only/configmap-otel-agent.yaml index f36f71dc0c..2a422c4138 100644 --- a/rendered/manifests/agent-only/configmap-otel-agent.yaml +++ b/rendered/manifests/agent-only/configmap-otel-agent.yaml @@ -203,8 +203,8 @@ data: - k8sattributes - batch - filter/logs - - resource/logs - resource + - resource/logs - resourcedetection receivers: - fluentforward diff --git a/rendered/manifests/agent-only/daemonset.yaml b/rendered/manifests/agent-only/daemonset.yaml index 99d240ae19..670ca2977b 100644 --- a/rendered/manifests/agent-only/daemonset.yaml +++ b/rendered/manifests/agent-only/daemonset.yaml @@ -28,7 +28,7 @@ spec: app: splunk-otel-collector release: default annotations: - checksum/config: 52e8817609546ab6ecf5a8e403605a5eb4f85ac8191d7c251814ac3d512dac0c + checksum/config: a6d79e9266fdb03b053855a5abd5e519189ebfbc6b81e192f77cd785da963369 kubectl.kubernetes.io/default-container: otel-collector spec: hostNetwork: true diff --git a/rendered/manifests/logs-only/configmap-otel-agent.yaml b/rendered/manifests/logs-only/configmap-otel-agent.yaml index 9ba217b933..d9f9a775cb 100644 --- a/rendered/manifests/logs-only/configmap-otel-agent.yaml +++ b/rendered/manifests/logs-only/configmap-otel-agent.yaml @@ -162,8 +162,8 @@ data: - k8sattributes - batch - filter/logs - - resource/logs - resource + - resource/logs - resourcedetection receivers: - fluentforward diff --git a/rendered/manifests/logs-only/daemonset.yaml b/rendered/manifests/logs-only/daemonset.yaml index f1762fb6a3..b4c60bf9da 100644 --- a/rendered/manifests/logs-only/daemonset.yaml +++ b/rendered/manifests/logs-only/daemonset.yaml @@ -28,7 +28,7 @@ spec: app: splunk-otel-collector release: default annotations: - checksum/config: b7b0093f43ac7c544c4bc89dd86e8700f21b408e9bf72d99796f6158a1da0ba7 + checksum/config: 6c9b7449f787bc4c7631753162320384d8103395de97f8419c671cc1f9f45782 kubectl.kubernetes.io/default-container: otel-collector spec: hostNetwork: true