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

field name compatibility for SCK #258

Merged
merged 6 commits into from
Nov 3, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 and index routing precedence (#258)
rockb1017 marked this conversation as resolved.
Show resolved Hide resolved

## [0.37.1] - 2021-11-01

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,53 @@ processors:
- k8s.pod.name
- k8s.pod.uid
{{- end }}
{{- if .Values.splunkPlatform.fieldNameConvention.renameFieldsSck }}
resource/sckcompatible:
attributes:
- 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: k8s.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 }}
{{- end }}
{{- if not .Values.splunkPlatform.fieldNameConvention.keepOtelContention }}
resource/removedups:
attributes:
- key: k8s.container.name
action: delete
- key: k8s.cluster.name
action: delete
- key: k8s.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 }}
dmitryax marked this conversation as resolved.
Show resolved Hide resolved
{{- end }}

{{- if not .Values.otelCollector.enabled }}
{{- include "splunk-otel-collector.resourceLogsProcessor" . | nindent 2 }}
Expand Down Expand Up @@ -438,6 +485,12 @@ service:
- filter/logs
- resource/logs
{{- end }}
{{- if .Values.splunkPlatform.fieldNameConvention.renameFieldsSck }}
- resource/sckcompatible
{{- if not .Values.splunkPlatform.fieldNameConvention.keepOtelContention }}
- resource/removedup
{{- end }}
{{- end }}
- resource
- resourcedetection
{{- if .Values.environment }}
Expand Down
12 changes: 12 additions & 0 deletions helm-charts/splunk-otel-collector/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
7 changes: 7 additions & 0 deletions helm-charts/splunk-otel-collector/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
################################################################################
Expand Down
16 changes: 16 additions & 0 deletions rendered/manifests/agent-only/configmap-otel-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,22 @@ data:
key: k8s.pod.annotations.splunk.com/sourcetype
- action: delete
key: splunk.com/exclude
resource/removedups:
attributes:
- action: delete
key: k8s.container.name
- action: delete
key: k8s.cluster.name
- action: delete
key: k8s.container.id
- action: delete
key: k8s.pod.name
- action: delete
key: k8s.pod.uid
- action: delete
key: k8s.namespace.name
- action: delete
key: k8s.pod.labels.app
resourcedetection:
detectors:
- env
Expand Down
2 changes: 1 addition & 1 deletion rendered/manifests/agent-only/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
app: splunk-otel-collector
release: default
annotations:
checksum/config: 52e8817609546ab6ecf5a8e403605a5eb4f85ac8191d7c251814ac3d512dac0c
checksum/config: be4ba2e1399a1d2288d813e0cbca8d6b648dff1f83cde9a11bf139d5a1a89366
kubectl.kubernetes.io/default-container: otel-collector
spec:
hostNetwork: true
Expand Down
16 changes: 16 additions & 0 deletions rendered/manifests/logs-only/configmap-otel-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,22 @@ data:
key: k8s.pod.annotations.splunk.com/sourcetype
- action: delete
key: splunk.com/exclude
resource/removedups:
attributes:
- action: delete
key: k8s.container.name
- action: delete
key: k8s.cluster.name
- action: delete
key: k8s.container.id
- action: delete
key: k8s.pod.name
- action: delete
key: k8s.pod.uid
- action: delete
key: k8s.namespace.name
- action: delete
key: k8s.pod.labels.app
resourcedetection:
detectors:
- env
Expand Down
2 changes: 1 addition & 1 deletion rendered/manifests/logs-only/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ spec:
app: splunk-otel-collector
release: default
annotations:
checksum/config: b7b0093f43ac7c544c4bc89dd86e8700f21b408e9bf72d99796f6158a1da0ba7
checksum/config: c145c11158d4aa80429c5d9308cc392741447bc3d9eb7833bc995886850573c9
kubectl.kubernetes.io/default-container: otel-collector
spec:
hostNetwork: true
Expand Down
16 changes: 16 additions & 0 deletions rendered/manifests/metrics-only/configmap-otel-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,22 @@ data:
key: k8s.pod.annotations.splunk.com/sourcetype
- action: delete
key: splunk.com/exclude
resource/removedups:
attributes:
- action: delete
key: k8s.container.name
- action: delete
key: k8s.cluster.name
- action: delete
key: k8s.container.id
- action: delete
key: k8s.pod.name
- action: delete
key: k8s.pod.uid
- action: delete
key: k8s.namespace.name
- action: delete
key: k8s.pod.labels.app
resourcedetection:
detectors:
- env
Expand Down
2 changes: 1 addition & 1 deletion rendered/manifests/metrics-only/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spec:
app: splunk-otel-collector
release: default
annotations:
checksum/config: a2ddd09def6ab417ec0967414e446ebf9adfae0e109ac263863cff98c23cdd7e
checksum/config: 11ca5b06cc846eec5681f027bf294164f8c929d5f18f80e9cd7ab02f43c6c378
kubectl.kubernetes.io/default-container: otel-collector
spec:
hostNetwork: true
Expand Down
16 changes: 16 additions & 0 deletions rendered/manifests/traces-only/configmap-otel-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,22 @@ data:
key: k8s.pod.annotations.splunk.com/sourcetype
- action: delete
key: splunk.com/exclude
resource/removedups:
attributes:
- action: delete
key: k8s.container.name
- action: delete
key: k8s.cluster.name
- action: delete
key: k8s.container.id
- action: delete
key: k8s.pod.name
- action: delete
key: k8s.pod.uid
- action: delete
key: k8s.namespace.name
- action: delete
key: k8s.pod.labels.app
resourcedetection:
detectors:
- env
Expand Down
2 changes: 1 addition & 1 deletion rendered/manifests/traces-only/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spec:
app: splunk-otel-collector
release: default
annotations:
checksum/config: f73b8bcab68386344194b87d6c10ab64684bb653f3b10b821247864a4da49c48
checksum/config: 16149c1fe266a62109e658d2c28cb87dabce8202d80f1b1af189718c560d0607
kubectl.kubernetes.io/default-container: otel-collector
spec:
hostNetwork: true
Expand Down