Skip to content

Commit

Permalink
Fix naming convention issue in helm chart (signalfx#660)
Browse files Browse the repository at this point in the history
While setting renameFieldsSck to true, the resource/logs sets the fields as per the SCK convention and copies their values from otel fields. But there are some otel fields which are not set in the first place.
So, move the resource above resource/logs as it sets all the required fields and the latter can then copy without any issues.
Also, add label_app field, if renameFieldsSck is true

The SCK's field container_image is split into two parts as per Otel convention i.e. image_name and image_tag, so combine them if user has enabled renameFieldsSck
  • Loading branch information
VihasMakwana authored Feb 23, 2023
1 parent c3ab252 commit 855add6
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ data:
- k8sattributes
- filter/logs
- batch
- resource
- resource/logs
- resourcedetection
- resource
receivers:
- fluentforward
- otlp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
app: splunk-otel-collector
release: default
annotations:
checksum/config: 9b4c6e5189c4f33ba448dfbdbe5e03c75d6a04e319452f4ba8e258fe52997bba
checksum/config: cac82800ded432062648f452c76ef29b6d1032da473a2a5dd4e6e77cddf5359e
kubectl.kubernetes.io/default-container: otel-collector
spec:
dnsPolicy: ClusterFirstWithHostNet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ data:
- k8sattributes
- filter/logs
- batch
- resource
- resource/logs
- resourcedetection
- resource
receivers:
- fluentforward
- otlp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
app: splunk-otel-collector
release: default
annotations:
checksum/config: 23076ae4687ac47f216f076d5dab7dab6e03d3b4d3f926c8e05de9ced7112821
checksum/config: c72a5536ce2ddd9792af9317f7d0f7b61e52a9f46c9e1819f79075f3da4c0311
kubectl.kubernetes.io/default-container: otel-collector
spec:
hostNetwork: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ data:
- k8sattributes
- filter/logs
- batch
- resource
- resource/logs
- resourcedetection
- resource
receivers:
- filelog
- fluentforward
Expand Down
2 changes: 1 addition & 1 deletion examples/only-logs-otel/rendered_manifests/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
app: splunk-otel-collector
release: default
annotations:
checksum/config: beb070897643ff6ccde9c4f764e43d8ca1aa59462a6df49f1e0b109c9e9a2726
checksum/config: 3248106e33590fd0e8b4b44a6dab21c89107ed723dd47f5cdc68f5e98928d2e7
kubectl.kubernetes.io/default-container: otel-collector
spec:
hostNetwork: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ data:
- k8sattributes
- filter/logs
- batch
- resource
- resource/logs
- resourcedetection
- resource
receivers:
- fluentforward
- otlp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
app: splunk-otel-collector
release: default
annotations:
checksum/config: 06c3daf120705029797394a1b5faee57ac67280eb59715fc8719517e72b9079b
checksum/config: 8ac5436b5288b63f3fd36651cdac742c6e722ed0b62349349718ff0824611e09
kubectl.kubernetes.io/default-container: otel-collector
spec:
hostNetwork: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ resource/logs:
- key: namespace
from_attribute: k8s.namespace.name
action: upsert
- key: label_app
from_attribute: k8s.pod.labels.app
action: upsert
{{- range $_, $label := .Values.extraAttributes.podLabels }}
- key: {{ printf "label_%s" $label }}
from_attribute: {{ printf "k8s.pod.labels.%s" $label }}
Expand All @@ -151,6 +154,8 @@ resource/logs:
action: delete
- key: k8s.namespace.name
action: delete
- key: k8s.pod.labels.app
action: delete
{{- range $_, $label := .Values.extraAttributes.podLabels }}
- key: {{ printf "k8s.pod.labels.%s" $label }}
action: delete
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,13 @@ processors:
{{- if not $gatewayEnabled }}
{{- include "splunk-otel-collector.resourceLogsProcessor" . | nindent 2 }}
{{- include "splunk-otel-collector.filterLogsProcessors" . | nindent 2 }}
{{- if .Values.splunkPlatform.fieldNameConvention.renameFieldsSck }}
transform/logs:
log_statements:
- context: log
statements:
- set(resource.attributes["container_image"], Concat([resource.attributes["container.image.name"],resource.attributes["container.image.tag"]], ":"))
{{- end }}
{{- end }}
{{- include "splunk-otel-collector.otelMemoryLimiterConfig" . | nindent 2 }}
Expand Down Expand Up @@ -644,11 +651,14 @@ service:
- filter/logs
{{- end }}
- batch
- resource
{{- if not $gatewayEnabled }}
{{- if .Values.splunkPlatform.fieldNameConvention.renameFieldsSck }}
- transform/logs
{{- end }}
- resource/logs
{{- end }}
- resourcedetection
- resource
{{- if .Values.environment }}
- resource/add_environment
{{- end }}
Expand Down

0 comments on commit 855add6

Please sign in to comment.