Skip to content

Commit 7053f21

Browse files
Merge branch 'main' into otl-3816-otlp-log-ingest
2 parents fb908e3 + 8abb526 commit 7053f21

15 files changed

Lines changed: 866 additions & 48 deletions

.chloggen/otl-3816-otlp-log-ingest.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
change_type: enhancement
33

44
# The name of the component, or a single word describing the area of concern, (e.g. agent, clusterReceiver, gateway, operator, chart, other)
5-
component: agent, gateway
5+
component: agent, gateway, clusterReceiver
66

77
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
88
note: Add OTLP log ingest option to send logs to Splunk Connect for OTLP instead of HEC
@@ -25,10 +25,13 @@ subtext: |
2525
enabled: true
2626
endpoint: "<splunk-connect-for-otlp-endpoint>"
2727
protocol: grpc # or "http"
28-
insecure: true
28+
insecure: false
2929
```
3030
31-
When `otlpIngest.enabled` is true and `logsEnabled` is true, the agent and gateway
32-
will use `otlp/platform_logs` (gRPC) or `otlp_http/platform_logs` (HTTP) exporters
33-
instead of `splunk_hec/platform_logs`. The `splunkPlatform.endpoint` field is not
34-
required when using OTLP ingest.
31+
When `otlpIngest.enabled` is true and `logsEnabled` is true, the agent, gateway,
32+
and cluster receiver log pipelines will use `otlp/platform_logs` (gRPC) or
33+
`otlp_http/platform_logs` (HTTP) exporters instead of `splunk_hec/platform_logs`.
34+
Use a base endpoint for HTTP, for example `http://splunk-host:4318`.
35+
The `splunkPlatform.endpoint` field is not required for logs when using OTLP
36+
ingest, but it is still required when `splunkPlatform.metricsEnabled` or
37+
`splunkPlatform.tracesEnabled` sends metrics or traces to Splunk Platform via HEC.

helm-charts/splunk-otel-collector/templates/_helpers.tpl

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,33 @@ Create chart name and version as used by the chart label.
3636
Whether to send data to Splunk Platform endpoint
3737
*/}}
3838
{{- define "splunk-otel-collector.splunkPlatformEnabled" -}}
39-
{{- or (not (eq .Values.splunkPlatform.endpoint "")) .Values.splunkPlatform.otlpIngest.enabled }}
39+
{{- not (eq .Values.splunkPlatform.endpoint "") }}
4040
{{- end -}}
4141

4242
{{/*
4343
Whether logs should be sent via OTLP to Splunk Connect for OTLP instead of HEC.
4444
*/}}
4545
{{- define "splunk-otel-collector.platformLogsViaOtlpEnabled" -}}
46-
{{- and .Values.splunkPlatform.otlpIngest.enabled .Values.splunkPlatform.logsEnabled }}
46+
{{- and ((.Values.splunkPlatform.otlpIngest).enabled) .Values.splunkPlatform.logsEnabled }}
47+
{{- end -}}
48+
49+
{{/*
50+
The exporter name for platform logs sent via OTLP (otlp/platform_logs or otlp_http/platform_logs).
51+
*/}}
52+
{{- define "splunk-otel-collector.otlpPlatformLogsExporterName" -}}
53+
{{- if eq .Values.splunkPlatform.otlpIngest.protocol "http" }}otlp_http{{- else }}otlp{{- end }}/platform_logs
54+
{{- end -}}
55+
56+
{{/*
57+
Whether Splunk Platform HEC token is required.
58+
*/}}
59+
{{- define "splunk-otel-collector.platformHecTokenRequired" -}}
60+
{{- or
61+
(and
62+
(eq (include "splunk-otel-collector.platformLogsEnabled" .) "true")
63+
(not (eq (include "splunk-otel-collector.platformLogsViaOtlpEnabled" .) "true")))
64+
(eq (include "splunk-otel-collector.platformMetricsEnabled" .) "true")
65+
(eq (include "splunk-otel-collector.platformTracesEnabled" .) "true") }}
4766
{{- end -}}
4867

4968
{{/*
@@ -113,7 +132,7 @@ Whether traces enabled for any destination.
113132
Whether logs enabled for any destination.
114133
*/}}
115134
{{- define "splunk-otel-collector.logsEnabled" -}}
116-
{{- include "splunk-otel-collector.platformLogsEnabled" . }}
135+
{{- or (eq (include "splunk-otel-collector.platformLogsEnabled" .) "true") (eq (include "splunk-otel-collector.platformLogsViaOtlpEnabled" .) "true") }}
117136
{{- end -}}
118137

119138
{{/*

helm-charts/splunk-otel-collector/templates/config/_common.tpl

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,17 @@ resource/logs:
333333
{{- end }}
334334
{{- end }}
335335

336+
{{/*
337+
Resource processor for Splunk Platform log defaults when logs are sent via OTLP.
338+
*/}}
339+
{{- define "splunk-otel-collector.otlpPlatformLogsResourceProcessor" -}}
340+
resource/otlp_platform_logs:
341+
attributes:
342+
- key: com.splunk.index
343+
value: {{ .Values.splunkPlatform.index | quote }}
344+
action: insert
345+
{{- end }}
346+
336347
{{/*
337348
Resource processor for metrics manipulations
338349
*/}}
@@ -389,7 +400,7 @@ Splunk Platform Logs exporter via OTLP (Splunk Connect for OTLP)
389400
{{- define "splunk-otel-collector.otlpPlatformLogsExporter" -}}
390401
{{- if eq .Values.splunkPlatform.otlpIngest.protocol "http" }}
391402
otlp_http/platform_logs:
392-
logs_endpoint: {{ .Values.splunkPlatform.otlpIngest.endpoint | quote }}
403+
endpoint: {{ .Values.splunkPlatform.otlpIngest.endpoint | quote }}
393404
tls:
394405
insecure: {{ .Values.splunkPlatform.otlpIngest.insecure }}
395406
{{- else }}
@@ -398,6 +409,28 @@ otlp/platform_logs:
398409
tls:
399410
insecure: {{ .Values.splunkPlatform.otlpIngest.insecure }}
400411
{{- end }}
412+
retry_on_failure:
413+
enabled: {{ .Values.splunkPlatform.retryOnFailure.enabled }}
414+
initial_interval: {{ .Values.splunkPlatform.retryOnFailure.initialInterval }}
415+
max_interval: {{ .Values.splunkPlatform.retryOnFailure.maxInterval }}
416+
{{- if .Values.featureGates.noDropLogsPipeline }}
417+
max_elapsed_time: 0s
418+
{{- else }}
419+
max_elapsed_time: {{ .Values.splunkPlatform.retryOnFailure.maxElapsedTime }}
420+
{{- end }}
421+
sending_queue:
422+
enabled: {{ .Values.splunkPlatform.sendingQueue.enabled }}
423+
queue_size: {{ .Values.splunkPlatform.sendingQueue.queueSize }}
424+
{{- if .addPersistentStorage }}
425+
storage: file_storage/persistent_queue
426+
{{- end }}
427+
num_consumers: {{ .Values.splunkPlatform.sendingQueue.numConsumers }}
428+
{{- if .Values.featureGates.noDropLogsPipeline }}
429+
batch:
430+
flush_timeout: 200ms
431+
min_size: 2048
432+
sizer: items
433+
{{- end }}
401434
{{- end -}}
402435

403436
{{/*

helm-charts/splunk-otel-collector/templates/config/_otel-agent.tpl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,10 @@ processors:
934934
key: k8s.namespace.name
935935
value: "${K8S_NAMESPACE}"
936936
937+
{{- if (eq (include "splunk-otel-collector.platformLogsViaOtlpEnabled" .) "true") }}
938+
{{- include "splunk-otel-collector.otlpPlatformLogsResourceProcessor" . | nindent 2 }}
939+
{{- end }}
940+
937941
{{- if .Values.environment }}
938942
resource/add_environment:
939943
attributes:
@@ -1196,6 +1200,9 @@ service:
11961200
- transform/istio_service_name
11971201
{{- end }}
11981202
- resource/logs
1203+
{{- if (eq (include "splunk-otel-collector.platformLogsViaOtlpEnabled" .) "true") }}
1204+
- resource/otlp_platform_logs
1205+
{{- end }}
11991206
{{- end }}
12001207
{{- if .Values.environment }}
12011208
- resource/add_environment
@@ -1208,7 +1215,7 @@ service:
12081215
- splunk_hec/o11y
12091216
{{- end }}
12101217
{{- if (eq (include "splunk-otel-collector.platformLogsViaOtlpEnabled" .) "true") }}
1211-
- {{ if eq .Values.splunkPlatform.otlpIngest.protocol "http" }}otlp_http{{- else }}otlp{{- end }}/platform_logs
1218+
- {{ include "splunk-otel-collector.otlpPlatformLogsExporterName" . }}
12121219
{{- else if (eq (include "splunk-otel-collector.platformLogsEnabled" .) "true") }}
12131220
- splunk_hec/platform_logs
12141221
{{- end }}
@@ -1237,6 +1244,9 @@ service:
12371244
- resourcedetection/k8s_cluster_name
12381245
{{- end }}
12391246
- resource
1247+
{{- if and (not .Values.gateway.enabled) (eq (include "splunk-otel-collector.platformLogsViaOtlpEnabled" .) "true") }}
1248+
- resource/otlp_platform_logs
1249+
{{- end }}
12401250
{{- if .Values.environment }}
12411251
- resource/add_environment
12421252
{{- end }}
@@ -1245,7 +1255,7 @@ service:
12451255
- otlp_grpc
12461256
{{- else }}
12471257
{{- if (eq (include "splunk-otel-collector.platformLogsViaOtlpEnabled" .) "true") }}
1248-
- {{ if eq .Values.splunkPlatform.otlpIngest.protocol "http" }}otlp_http{{- else }}otlp{{- end }}/platform_logs
1258+
- {{ include "splunk-otel-collector.otlpPlatformLogsExporterName" . }}
12491259
{{- else if eq (include "splunk-otel-collector.platformLogsEnabled" .) "true" }}
12501260
- splunk_hec/platform_logs
12511261
{{- end }}

helm-charts/splunk-otel-collector/templates/config/_otel-collector.tpl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ processors:
5252
{{- end }}
5353

5454
{{- include "splunk-otel-collector.resourceLogsProcessor" . | nindent 2 }}
55+
{{- if (eq (include "splunk-otel-collector.platformLogsViaOtlpEnabled" .) "true") }}
56+
{{- include "splunk-otel-collector.otlpPlatformLogsResourceProcessor" . | nindent 2 }}
57+
{{- end }}
5558
{{- if .Values.autodetect.istio }}
5659
{{- include "splunk-otel-collector.transformLogsProcessor" . | nindent 2 }}
5760
{{- end }}
@@ -327,12 +330,15 @@ service:
327330
- transform/istio_service_name
328331
{{- end }}
329332
- resource/logs
333+
{{- if (eq (include "splunk-otel-collector.platformLogsViaOtlpEnabled" .) "true") }}
334+
- resource/otlp_platform_logs
335+
{{- end }}
330336
exporters:
331337
{{- if (eq (include "splunk-otel-collector.o11yProfilingEnabled" .) "true") }}
332338
- splunk_hec/o11y
333339
{{- end }}
334340
{{- if (eq (include "splunk-otel-collector.platformLogsViaOtlpEnabled" .) "true") }}
335-
- {{ if eq .Values.splunkPlatform.otlpIngest.protocol "http" }}otlp_http{{- else }}otlp{{- end }}/platform_logs
341+
- {{ include "splunk-otel-collector.otlpPlatformLogsExporterName" . }}
336342
{{- else if (eq (include "splunk-otel-collector.platformLogsEnabled" .) "true") }}
337343
- splunk_hec/platform_logs
338344
{{- end }}

helm-charts/splunk-otel-collector/templates/config/_otel-k8s-cluster-receiver-config.tpl

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ processors:
156156
value: {{ .Values.clusterName }}
157157
{{- end }}
158158

159+
{{- if (eq (include "splunk-otel-collector.platformLogsViaOtlpEnabled" .) "true") }}
160+
{{- include "splunk-otel-collector.otlpPlatformLogsResourceProcessor" . | nindent 2 }}
161+
{{- end }}
162+
159163
{{- if eq (include "splunk-otel-collector.clusterReceiverEventsPipelineEnabled" $) "true" }}
160164

161165
# Add k8s event attributes - k8s.<kind>.name and k8s.<kind>.uid
@@ -178,6 +182,14 @@ processors:
178182
- merge_maps(resource.cache, ExtractPatterns(resource.attributes["k8s.object.fieldpath"], "spec.containers\\{(?P<k8s_container_name>[^\\}]+)\\}"), "insert")
179183
- set(resource.attributes["k8s.container.name"], resource.cache["k8s_container_name"])
180184

185+
{{- if (eq (include "splunk-otel-collector.platformLogsViaOtlpEnabled" .) "true") }}
186+
transform/add_events_sourcetype:
187+
log_statements:
188+
- context: log
189+
statements:
190+
- set(resource.attributes["com.splunk.sourcetype"], "kube:events")
191+
{{- end }}
192+
181193
# Drop high cardinality k8s event attributes
182194
attributes/drop_event_attrs:
183195
actions:
@@ -305,7 +317,9 @@ exporters:
305317
{{- include "splunk-otel-collector.splunkPlatformMetricsExporter" . | nindent 2 }}
306318
{{- end }}
307319

308-
{{- if and (eq (include "splunk-otel-collector.platformLogsEnabled" .) "true") (eq (include "splunk-otel-collector.objectsOrEventsEnabled" .) "true") }}
320+
{{- if and (eq (include "splunk-otel-collector.platformLogsViaOtlpEnabled" .) "true") (eq (include "splunk-otel-collector.objectsOrEventsEnabled" .) "true") }}
321+
{{- include "splunk-otel-collector.otlpPlatformLogsExporter" . | nindent 2 }}
322+
{{- else if and (eq (include "splunk-otel-collector.platformLogsEnabled" .) "true") (eq (include "splunk-otel-collector.objectsOrEventsEnabled" .) "true") }}
309323
{{- include "splunk-otel-collector.splunkPlatformLogsExporter" . | nindent 2 }}
310324
{{- if .Values.clusterReceiver.eventsEnabled }}
311325
sourcetype: kube:events
@@ -437,9 +451,15 @@ service:
437451
{{- if .Values.environment }}
438452
- resource/add_environment
439453
{{- end }}
454+
{{- if (eq (include "splunk-otel-collector.platformLogsViaOtlpEnabled" .) "true") }}
455+
- resource/otlp_platform_logs
456+
- transform/add_events_sourcetype
457+
{{- end }}
440458
- transform/k8sevents
441459
exporters:
442-
{{- if (eq (include "splunk-otel-collector.platformLogsEnabled" .) "true") }}
460+
{{- if (eq (include "splunk-otel-collector.platformLogsViaOtlpEnabled" .) "true") }}
461+
- {{ include "splunk-otel-collector.otlpPlatformLogsExporterName" . }}
462+
{{- else if (eq (include "splunk-otel-collector.platformLogsEnabled" .) "true") }}
443463
- splunk_hec/platform_logs
444464
{{- end }}
445465
{{- if eq (include "splunk-otel-collector.splunkO11yEventsEndpointEnabled" .) "true" }}
@@ -460,11 +480,16 @@ service:
460480
- resource
461481
- resource/add_cluster_host
462482
- transform/add_sourcetype
483+
{{- if (eq (include "splunk-otel-collector.platformLogsViaOtlpEnabled" .) "true") }}
484+
- resource/otlp_platform_logs
485+
{{- end }}
463486
{{- if .Values.environment }}
464487
- resource/add_environment
465488
{{- end }}
466489
exporters:
467-
{{- if (eq (include "splunk-otel-collector.platformLogsEnabled" .) "true") }}
490+
{{- if (eq (include "splunk-otel-collector.platformLogsViaOtlpEnabled" .) "true") }}
491+
- {{ include "splunk-otel-collector.otlpPlatformLogsExporterName" . }}
492+
{{- else if (eq (include "splunk-otel-collector.platformLogsEnabled" .) "true") }}
468493
- splunk_hec/platform_logs
469494
{{- end }}
470495
{{- if (eq (include "splunk-otel-collector.splunkO11yEventsEndpointEnabled" .) "true") }}

helm-charts/splunk-otel-collector/templates/daemonset.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ spec:
207207
name: {{ include "splunk-otel-collector.secret" . }}
208208
key: splunk_observability_access_token
209209
{{- end }}
210-
{{- if (eq (include "splunk-otel-collector.splunkPlatformEnabled" .) "true") }}
210+
{{- if (eq (include "splunk-otel-collector.platformHecTokenRequired" .) "true") }}
211211
- name: SPLUNK_PLATFORM_HEC_TOKEN
212212
valueFrom:
213213
secretKeyRef:

helm-charts/splunk-otel-collector/templates/deployment-cluster-receiver.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ spec:
171171
name: {{ include "splunk-otel-collector.secret" . }}
172172
key: splunk_observability_access_token
173173
{{- end }}
174-
{{- if (eq (include "splunk-otel-collector.splunkPlatformEnabled" .) "true") }}
174+
{{- if (eq (include "splunk-otel-collector.platformHecTokenRequired" .) "true") }}
175175
- name: SPLUNK_PLATFORM_HEC_TOKEN
176176
valueFrom:
177177
secretKeyRef:

helm-charts/splunk-otel-collector/templates/deployment-gateway.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ spec:
124124
name: {{ include "splunk-otel-collector.secret" . }}
125125
key: splunk_observability_access_token
126126
{{- end }}
127-
{{- if (eq (include "splunk-otel-collector.splunkPlatformEnabled" .) "true") }}
127+
{{- if (eq (include "splunk-otel-collector.platformHecTokenRequired" .) "true") }}
128128
- name: SPLUNK_PLATFORM_HEC_TOKEN
129129
valueFrom:
130130
secretKeyRef:

helm-charts/splunk-otel-collector/templates/secret-splunk-validation-hook.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ spec:
2525
doesn\'t have required field \"splunk_observability_access_token\".;
2626
export TOKEN_INVALID=true;
2727
fi;
28-
if [ "{{ include "splunk-otel-collector.splunkPlatformEnabled" . }}" = "true" ] && [ ! -f /otel/secret/splunk_platform_hec_token ]; then
28+
if [ "{{ include "splunk-otel-collector.platformHecTokenRequired" . }}" = "true" ] && [ ! -f /otel/secret/splunk_platform_hec_token ]; then
2929
echo Splunk Platform destination is enabled, but custom Kubernetes\
3030
secret \"{{ template "splunk-otel-collector.secret" . }}\" doesn\'t\
3131
have required field \"splunk_platform_hec_token\".;

0 commit comments

Comments
 (0)