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 all 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 (#258)

## [0.37.1] - 2021-11-01

### Added
Expand Down
43 changes: 43 additions & 0 deletions helm-charts/splunk-otel-collector/templates/config/_common.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

{{/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
2 changes: 1 addition & 1 deletion rendered/manifests/agent-only/configmap-otel-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ data:
- k8sattributes
- batch
- filter/logs
- resource/logs
- resource
- resource/logs
- resourcedetection
receivers:
- fluentforward
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: a6d79e9266fdb03b053855a5abd5e519189ebfbc6b81e192f77cd785da963369
kubectl.kubernetes.io/default-container: otel-collector
spec:
hostNetwork: true
Expand Down
2 changes: 1 addition & 1 deletion rendered/manifests/logs-only/configmap-otel-agent.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ data:
- k8sattributes
- batch
- filter/logs
- resource/logs
- resource
- resource/logs
- resourcedetection
receivers:
- fluentforward
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: 6c9b7449f787bc4c7631753162320384d8103395de97f8419c671cc1f9f45782
kubectl.kubernetes.io/default-container: otel-collector
spec:
hostNetwork: true
Expand Down