-
Notifications
You must be signed in to change notification settings - Fork 151
/
_otel-agent.tpl
772 lines (737 loc) · 27.2 KB
/
_otel-agent.tpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
{{/*
Config for the otel-collector agent
The values can be overridden in .Values.agent.config
*/}}
{{- define "splunk-otel-collector.agentConfig" -}}
{{ $gateway := fromYaml (include "splunk-otel-collector.gateway" .) -}}
extensions:
{{- if and (eq (include "splunk-otel-collector.logsEnabled" .) "true") (eq .Values.logsEngine "otel") }}
file_storage:
directory: {{ .Values.logsCollection.checkpointPath }}
{{- end }}
memory_ballast:
size_mib: ${SPLUNK_BALLAST_SIZE_MIB}
health_check:
k8s_observer:
auth_type: serviceAccount
node: ${K8S_NODE_NAME}
zpages:
receivers:
{{- include "splunk-otel-collector.otelReceivers" . | nindent 2 }}
{{- if (eq (include "splunk-otel-collector.logsEnabled" .) "true") }}
fluentforward:
endpoint: 0.0.0.0:8006
{{- end }}
# Prometheus receiver scraping metrics from the pod itself
prometheus/agent:
config:
scrape_configs:
- job_name: 'otel-agent'
scrape_interval: 10s
static_configs:
- targets:
- "${K8S_POD_IP}:8889"
# Fluend metrics collection disabled by default
# - "${K8S_POD_IP}:24231"
{{- if (eq (include "splunk-otel-collector.metricsEnabled" .) "true") }}
hostmetrics:
collection_interval: 10s
scrapers:
cpu:
disk:
filesystem:
memory:
network:
# System load average metrics https://en.wikipedia.org/wiki/Load_(computing)
load:
# Paging/Swap space utilization and I/O metrics
paging:
# Aggregated system process count metrics
processes:
# System processes metrics, disabled by default
# process:
receiver_creator:
watch_observers: [k8s_observer]
receivers:
{{- if or .Values.autodetect.prometheus .Values.autodetect.istio }}
prometheus_simple:
{{- if .Values.autodetect.prometheus }}
# Enable prometheus scraping for pods with standard prometheus annotations
rule: type == "pod" && annotations["prometheus.io/scrape"] == "true"
{{- else }}
# Enable prometheus scraping for istio pods only
rule: type == "pod" && annotations["prometheus.io/scrape"] == "true" && "istio.io/rev" in labels
{{- end }}
config:
metrics_path: '`"prometheus.io/path" in annotations ? annotations["prometheus.io/path"] : "/metrics"`'
endpoint: '`endpoint`:`"prometheus.io/port" in annotations ? annotations["prometheus.io/port"] : 9090`'
{{- end }}
# Receivers for collecting k8s control plane metrics.
# Distributions besides Kubernetes and Openshift are not supported.
# Verified with Kubernetes v1.22 and Openshift v4.9.
{{- if or (eq .Values.distribution "openshift") (eq .Values.distribution "") }}
# Below, the TLS certificate verification is often skipped because the k8s default certificate is self signed and
# will fail the verification.
{{- if .Values.agent.controlPlaneMetrics.coredns.enabled }}
smartagent/coredns:
{{- if eq .Values.distribution "openshift" }}
rule: type == "pod" && namespace == "openshift-dns" && name contains "dns"
{{- else }}
rule: type == "pod" && labels["k8s-app"] == "kube-dns"
{{- end }}
config:
extraDimensions:
metric_source: k8s-coredns
type: coredns
{{- if eq .Values.distribution "openshift" }}
port: 9154
skipVerify: true
useHTTPS: true
useServiceAccount: true
{{- else }}
port: 9153
{{- end }}
{{- end }}
{{- if .Values.agent.controlPlaneMetrics.etcd.enabled }}
smartagent/etcd:
{{- if eq .Values.distribution "openshift" }}
rule: type == "pod" && labels["k8s-app"] == "etcd"
{{- else }}
rule: type == "pod" && (labels["k8s-app"] == "etcd-manager-events" || labels["k8s-app"] == "etcd-manager-main")
{{- end }}
config:
clientCertPath: /otel/etc/etcd/tls.crt
clientKeyPath: /otel/etc/etcd/tls.key
useHTTPS: true
type: etcd
{{- if .Values.agent.controlPlaneMetrics.etcd.skipVerify }}
skipVerify: true
{{- else }}
caCertPath: /otel/etc/etcd/cacert.pem
skipVerify: false
{{- end }}
{{- if eq .Values.distribution "openshift" }}
port: 9979
{{- else }}
port: 4001
{{- end }}
{{- end }}
{{- if .Values.agent.controlPlaneMetrics.controllerManager.enabled }}
smartagent/kube-controller-manager:
{{- if eq .Values.distribution "openshift" }}
rule: type == "pod" && labels["app"] == "kube-controller-manager" && labels["kube-controller-manager"] == "true"
{{- else }}
rule: type == "pod" && labels["k8s-app"] == "kube-controller-manager"
{{- end }}
config:
extraDimensions:
metric_source: kubernetes-controller-manager
port: 10257
skipVerify: true
type: kube-controller-manager
useHTTPS: true
useServiceAccount: true
{{- end }}
{{- if .Values.agent.controlPlaneMetrics.apiserver.enabled }}
smartagent/kubernetes-apiserver:
{{- if eq .Values.distribution "openshift" }}
rule: type == "port" && port == 6443 && pod.labels["app"] == "openshift-kube-apiserver" && pod.labels["apiserver"] == "true"
{{- else }}
rule: type == "port" && port == 443 && pod.labels["k8s-app"] == "kube-apiserver"
{{- end }}
config:
extraDimensions:
metric_source: kubernetes-apiserver
skipVerify: true
type: kubernetes-apiserver
useHTTPS: true
useServiceAccount: true
{{- end }}
{{- if .Values.agent.controlPlaneMetrics.proxy.enabled }}
smartagent/kubernetes-proxy:
{{- if eq .Values.distribution "openshift" }}
rule: type == "pod" && labels["app"] == "sdn"
{{- else }}
rule: type == "pod" && labels["k8s-app"] == "kube-proxy"
{{- end }}
config:
extraDimensions:
metric_source: kubernetes-proxy
type: kubernetes-proxy
{{- if eq .Values.distribution "openshift" }}
port: 29101
{{- else }}
port: 10249
{{- end }}
{{- end }}
{{- if .Values.agent.controlPlaneMetrics.scheduler.enabled }}
smartagent/kubernetes-scheduler:
{{- if eq .Values.distribution "openshift" }}
rule: type == "pod" && labels["app"] == "openshift-kube-scheduler" && labels["scheduler"] == "true"
{{- else }}
rule: type == "pod" && labels["k8s-app"] == "kube-scheduler"
{{- end }}
config:
extraDimensions:
metric_source: kubernetes-scheduler
port: 10251
type: kubernetes-scheduler
{{- end }}
{{- end }}
kubeletstats:
collection_interval: 10s
{{- if eq .Values.distribution "gke/autopilot" }}
# GKE Autopilot doesn't allow using the secure kubelet endpoint,
# use the read-only endpoint instead.
auth_type: none
endpoint: ${K8S_NODE_IP}:10255
{{- else }}
auth_type: serviceAccount
endpoint: ${K8S_NODE_IP}:10250
{{- end }}
metric_groups:
- container
- pod
- node
# Volume metrics are not collected by default
# - volume
# To collect metadata from underlying storage resources, set k8s_api_config and list k8s.volume.type
# under extra_metadata_labels
# k8s_api_config:
# auth_type: serviceAccount
extra_metadata_labels:
- container.id
# - k8s.volume.type
signalfx:
endpoint: 0.0.0.0:9943
{{- end }}
{{- if (eq (include "splunk-otel-collector.o11yTracesEnabled" .) "true") }}
smartagent/signalfx-forwarder:
type: signalfx-forwarder
listenAddress: 0.0.0.0:9080
{{- end }}
{{- if and (eq (include "splunk-otel-collector.logsEnabled" .) "true") (eq .Values.logsEngine "otel") }}
{{- if .Values.logsCollection.containers.enabled }}
filelog:
{{- if .Values.isWindows }}
include: ["C:\\var\\log\\pods\\*\\*\\*.log"]
{{- else }}
include: ["/var/log/pods/*/*/*.log"]
{{- end }}
# Exclude logs. The file format is
# /var/log/pods/<namespace_name>_<pod_name>_<pod_uid>/<container_name>/<restart_count>.log
exclude:
{{- if .Values.logsCollection.containers.excludeAgentLogs }}
{{- if .Values.isWindows }}
- "C:\\var\\log\\pods\\{{ .Release.Namespace }}_{{ include "splunk-otel-collector.fullname" . }}*_*\\otel-collector\\*.log"
{{- else }}
- /var/log/pods/{{ .Release.Namespace }}_{{ include "splunk-otel-collector.fullname" . }}*_*/otel-collector/*.log
{{- end }}
{{- end }}
{{- range $_, $excludePath := .Values.logsCollection.containers.excludePaths }}
- {{ $excludePath }}
{{- end }}
start_at: beginning
include_file_path: true
include_file_name: false
poll_interval: 200ms
max_concurrent_files: 1024
encoding: utf-8
fingerprint_size: 1kb
max_log_size: 1MiB
# Disable force flush until this issue is fixed:
# https://github.com/open-telemetry/opentelemetry-log-collection/issues/292
force_flush_period: "0"
operators:
{{- if not .Values.logsCollection.containers.containerRuntime }}
- type: router
id: get-format
routes:
- output: parser-docker
expr: 'body matches "^\\{"'
- output: parser-crio
expr: 'body matches "^[^ Z]+ "'
- output: parser-containerd
expr: 'body matches "^[^ Z]+Z"'
{{- end }}
{{- if or (not .Values.logsCollection.containers.containerRuntime) (eq .Values.logsCollection.containers.containerRuntime "cri-o") }}
# Parse CRI-O format
- type: regex_parser
id: parser-crio
regex: '^(?P<time>[^ Z]+) (?P<stream>stdout|stderr) (?P<logtag>[^ ]*) ?(?P<log>.*)$'
timestamp:
parse_from: attributes.time
layout_type: gotime
layout: '2006-01-02T15:04:05.999999999-07:00'
- type: recombine
id: crio-recombine
output: handle_empty_log
combine_field: attributes.log
source_identifier: attributes["log.file.path"]
is_last_entry: "attributes.logtag == 'F'"
combine_with: ""
{{- end }}
{{- if or (not .Values.logsCollection.containers.containerRuntime) (eq .Values.logsCollection.containers.containerRuntime "containerd") }}
# Parse CRI-Containerd format
- type: regex_parser
id: parser-containerd
regex: '^(?P<time>[^ ^Z]+Z) (?P<stream>stdout|stderr) (?P<logtag>[^ ]*) ?(?P<log>.*)$'
timestamp:
parse_from: attributes.time
layout: '%Y-%m-%dT%H:%M:%S.%LZ'
- type: recombine
id: containerd-recombine
output: handle_empty_log
combine_field: attributes.log
source_identifier: attributes["log.file.path"]
is_last_entry: "attributes.logtag == 'F'"
combine_with: ""
{{- end }}
{{- if or (not .Values.logsCollection.containers.containerRuntime) (eq .Values.logsCollection.containers.containerRuntime "docker") }}
# Parse Docker format
- type: json_parser
id: parser-docker
output: handle_empty_log
timestamp:
parse_from: attributes.time
layout: '%Y-%m-%dT%H:%M:%S.%LZ'
- type: recombine
id: docker-recombine
output: handle_empty_log
combine_field: attributes.log
source_identifier: attributes["log.file.path"]
is_last_entry: attributes.log endsWith "\n"
combine_with: ""
{{- end }}
- type: add
id: handle_empty_log
if: attributes.log == nil
field: attributes.log
value: ""
# Extract metadata from file path
- type: regex_parser
{{- if .Values.isWindows }}
regex: '^C:\\var\\log\\pods\\(?P<namespace>[^_]+)_(?P<pod_name>[^_]+)_(?P<uid>[^\/]+)\\(?P<container_name>[^\._]+)\\(?P<restart_count>\d+)\.log$'
{{- else }}
regex: '^\/var\/log\/pods\/(?P<namespace>[^_]+)_(?P<pod_name>[^_]+)_(?P<uid>[^\/]+)\/(?P<container_name>[^\._]+)\/(?P<restart_count>\d+)\.log$'
{{- end }}
parse_from: attributes["log.file.path"]
# Move out attributes to Attributes
- type: move
from: attributes.uid
to: resource["k8s.pod.uid"]
- type: move
from: attributes.restart_count
to: resource["k8s.container.restart_count"]
- type: move
from: attributes.container_name
to: resource["k8s.container.name"]
- type: move
from: attributes.namespace
to: resource["k8s.namespace.name"]
- type: move
from: attributes.pod_name
to: resource["k8s.pod.name"]
- type: add
field: resource["com.splunk.sourcetype"]
value: EXPR("kube:container:"+resource["k8s.container.name"])
- type: move
from: attributes.stream
to: attributes["log.iostream"]
- type: move
from: attributes["log.file.path"]
to: resource["com.splunk.source"]
{{- if .Values.logsCollection.containers.multilineConfigs }}
- type: router
routes:
{{- range $.Values.logsCollection.containers.multilineConfigs }}
- output: {{ include "splunk-otel-collector.newlineKey" . | quote }}
expr: {{ include "splunk-otel-collector.newlineExpr" . | quote }}
{{- end }}
default: clean-up-log-record
{{- range $.Values.logsCollection.containers.multilineConfigs }}
- type: recombine
id: {{ include "splunk-otel-collector.newlineKey" . | quote}}
output: clean-up-log-record
source_identifier: resource["com.splunk.source"]
combine_field: attributes.log
is_first_entry: '(attributes.log) matches {{ .firstEntryRegex | quote }}'
{{- end }}
{{- end }}
{{- with .Values.logsCollection.containers.extraOperators }}
{{ . | toYaml | nindent 6 }}
{{- end }}
# Clean up log record
- type: move
id: clean-up-log-record
from: attributes.log
to: body
{{- end }}
{{- if .Values.logsCollection.extraFileLogs }}
{{- toYaml .Values.logsCollection.extraFileLogs | nindent 2 }}
{{- end }}
# https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/journaldreceiver
{{- if .Values.logsCollection.journald.enabled }}
{{- range $_, $unit := .Values.logsCollection.journald.units }}
{{- printf "journald/%s:" $unit.name | nindent 2 }}
directory: {{ $.Values.logsCollection.journald.directory }}
units: [{{ $unit.name }}]
priority: {{ $unit.priority }}
operators:
- type: add
field: resource["com.splunk.source"]
value: {{ $.Values.logsCollection.journald.directory }}
- type: add
field: resource["com.splunk.sourcetype"]
value: 'EXPR("kube:journald:"+body._SYSTEMD_UNIT)'
- type: add
field: resource["com.splunk.index"]
value: {{ $.Values.logsCollection.journald.index | default $.Values.splunkPlatform.index }}
- type: add
field: resource["host.name"]
value: 'EXPR(env("K8S_NODE_NAME"))'
- type: add
field: resource["journald.priority.number"]
value: 'EXPR(body.PRIORITY)'
- type: add
field: resource["journald.unit.name"]
value: 'EXPR(body._SYSTEMD_UNIT)'
# extract MESSAGE field into the log body and discard rest of the fields
- type: move
id: set-body
from: body.MESSAGE
to: body
{{- end }}
{{- end }}
{{- end }}
# By default k8sattributes and batch processors enabled.
processors:
# k8sattributes enriches traces and metrics with k8s metadata
k8sattributes:
# If gateway deployment is enabled, the `passthrough` configuration is enabled by default.
# It means that traces and metrics enrichment happens in the gateway, and the agent only passes information
# about traces and metrics source, without calling k8s API.
{{- if $gateway.enabled }}
passthrough: true
{{- end }}
filter:
node_from_env_var: K8S_NODE_NAME
pod_association:
- sources:
- from: resource_attribute
name: k8s.pod.uid
- sources:
- from: resource_attribute
name: k8s.pod.ip
- sources:
- from: resource_attribute
name: ip
- sources:
- from: connection
- sources:
- from: resource_attribute
name: host.name
extract:
metadata:
- k8s.namespace.name
- k8s.node.name
- k8s.pod.name
- k8s.pod.uid
- container.id
- container.image.name
- container.image.tag
annotations:
- key: splunk.com/sourcetype
from: pod
- key: {{ include "splunk-otel-collector.filterAttr" . }}
tag_name: {{ include "splunk-otel-collector.filterAttr" . }}
from: namespace
- key: {{ include "splunk-otel-collector.filterAttr" . }}
tag_name: {{ include "splunk-otel-collector.filterAttr" . }}
from: pod
- key: splunk.com/index
tag_name: com.splunk.index
from: namespace
- key: splunk.com/index
tag_name: com.splunk.index
from: pod
{{- include "splunk-otel-collector.addExtraAnnotations" . | nindent 8 }}
{{- if or .Values.extraAttributes.podLabels .Values.extraAttributes.fromLabels }}
labels:
{{- range .Values.extraAttributes.podLabels }}
- key: {{ . }}
{{- end }}
{{- include "splunk-otel-collector.addExtraLabels" . | nindent 8 }}
{{- end }}
{{- if eq .Values.logsEngine "fluentd" }}
# Move flat fluentd logs attributes to resource attributes
groupbyattrs/logs:
keys:
- com.splunk.source
- com.splunk.sourcetype
- container.id
- fluent.tag
- istio_service_name
- k8s.container.name
- k8s.namespace.name
- k8s.pod.name
- k8s.pod.uid
{{- end }}
{{- if not $gateway.enabled }}
{{- include "splunk-otel-collector.resourceLogsProcessor" . | nindent 2 }}
{{- include "splunk-otel-collector.filterLogsProcessors" . | nindent 2 }}
{{- end }}
{{- include "splunk-otel-collector.otelMemoryLimiterConfig" . | nindent 2 }}
batch:
# Resource detection processor is configured to override all host and cloud
# attributes because OTel Collector Agent is the source of truth for all host
# and cloud metadata, and instrumentation libraries can send wrong host
# attributes from container environments.
{{- include "splunk-otel-collector.resourceDetectionProcessor" . | nindent 2 }}
resource:
# General resource attributes that apply to all telemetry passing through the agent.
attributes:
- action: insert
key: k8s.node.name
value: "${K8S_NODE_NAME}"
- action: upsert
key: k8s.cluster.name
value: {{ .Values.clusterName }}
{{- range .Values.extraAttributes.custom }}
- action: insert
key: "{{ .name }}"
value: "{{ .value }}"
{{- end }}
# Resource attributes specific to the agent itself.
resource/add_agent_k8s:
attributes:
- action: insert
key: k8s.pod.name
value: "${K8S_POD_NAME}"
- action: insert
key: k8s.pod.uid
value: "${K8S_POD_UID}"
- action: insert
key: k8s.namespace.name
value: "${K8S_NAMESPACE}"
{{- if .Values.environment }}
resource/add_environment:
attributes:
- action: insert
key: deployment.environment
value: "{{ .Values.environment }}"
{{- end }}
{{- if .Values.isWindows }}
metricstransform:
transforms:
- include: container.memory.working_set
action: insert
new_name: container.memory.usage
{{- end }}
# By default only SAPM exporter enabled. It will be pointed to collector deployment if enabled,
# Otherwise it's pointed directly to signalfx backend based on the values provided in signalfx setting.
# These values should not be specified manually and will be set in the templates.
exporters:
{{- if $gateway.enabled }}
# If gateway is enabled, metrics, logs and traces will be sent to the gateway
otlp:
endpoint: {{ include "splunk-otel-collector.fullname" . }}:4317
tls:
insecure: true
{{- else }}
# If gateway is disabled, data will be sent to directly to backends.
{{- if (eq (include "splunk-otel-collector.o11yTracesEnabled" .) "true") }}
{{- include "splunk-otel-collector.otelSapmExporter" . | nindent 2 }}
{{- end }}
{{- if (eq (include "splunk-otel-collector.o11yLogsOrProfilingEnabled" .) "true") }}
splunk_hec/o11y:
endpoint: {{ include "splunk-otel-collector.o11yIngestUrl" . }}/v1/log
token: "${SPLUNK_OBSERVABILITY_ACCESS_TOKEN}"
log_data_enabled: {{ .Values.splunkObservability.logsEnabled }}
profiling_data_enabled: {{ .Values.splunkObservability.profilingEnabled }}
{{- end }}
{{- if (eq (include "splunk-otel-collector.platformLogsEnabled" .) "true") }}
{{- include "splunk-otel-collector.splunkPlatformLogsExporter" . | nindent 2 }}
{{- end }}
{{- if (eq (include "splunk-otel-collector.platformMetricsEnabled" .) "true") }}
{{- include "splunk-otel-collector.splunkPlatformMetricsExporter" . | nindent 2 }}
{{- end }}
{{- end }}
{{- if (eq (include "splunk-otel-collector.splunkO11yEnabled" .) "true") }}
signalfx:
correlation:
{{- if $gateway.enabled }}
ingest_url: http://{{ include "splunk-otel-collector.fullname" . }}:9943
api_url: http://{{ include "splunk-otel-collector.fullname" . }}:6060
{{- else }}
ingest_url: {{ include "splunk-otel-collector.o11yIngestUrl" . }}
api_url: {{ include "splunk-otel-collector.o11yApiUrl" . }}
{{- end }}
access_token: ${SPLUNK_OBSERVABILITY_ACCESS_TOKEN}
sync_host_metadata: true
{{- end }}
service:
telemetry:
metrics:
address: 0.0.0.0:8889
extensions:
{{- if and (eq (include "splunk-otel-collector.logsEnabled" .) "true") (eq .Values.logsEngine "otel") }}
- file_storage
{{- end }}
- health_check
- k8s_observer
- memory_ballast
- zpages
# By default there are two pipelines sending metrics and traces to standalone otel-collector otlp format
# or directly to signalfx backend depending on gateway.enabled configuration.
# The default pipelines should to be changed. You can add any custom pipeline instead.
# In order to disable a default pipeline just set it to `null` in agent.config overrides.
pipelines:
{{- if or (eq (include "splunk-otel-collector.logsEnabled" .) "true") (eq (include "splunk-otel-collector.profilingEnabled" .) "true") }}
logs:
receivers:
{{- if (eq (include "splunk-otel-collector.logsEnabled" .) "true") }}
{{- if and (eq .Values.logsEngine "otel") .Values.logsCollection.containers.enabled }}
- filelog
{{- end }}
- fluentforward
{{- end }}
- otlp
processors:
- memory_limiter
{{- if and (eq (include "splunk-otel-collector.logsEnabled" .) "true") (eq .Values.logsEngine "fluentd") }}
- groupbyattrs/logs
{{- end }}
- k8sattributes
{{- if not $gateway.enabled }}
- filter/logs
{{- end }}
- batch
{{- if not $gateway.enabled }}
- resource/logs
{{- end }}
- resourcedetection
- resource
{{- if .Values.environment }}
- resource/add_environment
{{- end }}
exporters:
{{- if $gateway.enabled }}
- otlp
{{- else }}
{{- if (eq (include "splunk-otel-collector.o11yLogsOrProfilingEnabled" .) "true") }}
- splunk_hec/o11y
{{- end }}
{{- if (eq (include "splunk-otel-collector.platformLogsEnabled" .) "true") }}
- splunk_hec/platform_logs
{{- end }}
{{- end }}
{{- if and (eq .Values.logsEngine "otel") (or .Values.logsCollection.extraFileLogs .Values.logsCollection.journald.enabled) }}
logs/host:
receivers:
{{- if .Values.logsCollection.extraFileLogs }}
{{- range $key, $exporterData := .Values.logsCollection.extraFileLogs }}
- {{ $key }}
{{- end }}
{{- end }}
{{- if (.Values.logsCollection.journald.enabled)}}
{{- range $_, $unit := .Values.logsCollection.journald.units }}
{{- printf "- journald/%s" $unit.name | nindent 8 }}
{{- end }}
{{- end }}
processors:
- memory_limiter
- batch
- resource
{{- if .Values.environment }}
- resource/add_environment
{{- end }}
exporters:
{{- if $gateway.enabled }}
- otlp
{{- else }}
{{- if eq (include "splunk-otel-collector.platformLogsEnabled" .) "true" }}
- splunk_hec/platform_logs
{{- end }}
{{- if eq (include "splunk-otel-collector.o11yLogsEnabled" .) "true" }}
- splunk_hec/o11y
{{- end }}
{{- end }}
{{- end }}
{{- end }}
{{- if (eq (include "splunk-otel-collector.tracesEnabled" .) "true") }}
# Default traces pipeline.
traces:
receivers: [otlp, jaeger, smartagent/signalfx-forwarder, zipkin]
processors:
- memory_limiter
- k8sattributes
- batch
- resourcedetection
- resource
{{- if .Values.environment }}
- resource/add_environment
{{- end }}
exporters:
{{- if $gateway.enabled }}
- otlp
{{- else }}
- sapm
{{- end }}
{{- if (eq (include "splunk-otel-collector.o11yMetricsEnabled" $) "true") }}
# For trace/metric correlation.
- signalfx
{{- end }}
{{- end }}
{{- if (eq (include "splunk-otel-collector.metricsEnabled" .) "true") }}
# Default metrics pipeline.
metrics:
receivers: [hostmetrics, kubeletstats, otlp, receiver_creator, signalfx]
processors:
- memory_limiter
- batch
- resourcedetection
- resource
{{- if (and .Values.splunkPlatform.metricsEnabled .Values.environment) }}
- resource/add_environment
{{- end }}
{{- if .Values.isWindows }}
- metricstransform
{{- end }}
exporters:
{{- if $gateway.enabled }}
- otlp
{{- else }}
{{- if (eq (include "splunk-otel-collector.o11yMetricsEnabled" .) "true") }}
- signalfx
{{- end }}
{{- if (eq (include "splunk-otel-collector.platformMetricsEnabled" .) "true") }}
- splunk_hec/platform_metrics
{{- end }}
{{- end }}
{{- end }}
{{- if or (eq (include "splunk-otel-collector.splunkO11yEnabled" .) "true") (eq (include "splunk-otel-collector.platformMetricsEnabled" .) "true") }}
# Pipeline for metrics collected about the agent pod itself.
metrics/agent:
receivers: [prometheus/agent]
processors:
- memory_limiter
- batch
- resource/add_agent_k8s
- resourcedetection
- resource
exporters:
{{- if (eq (include "splunk-otel-collector.splunkO11yEnabled" .) "true") }}
# Use signalfx instead of otlp even if collector is enabled
# in order to sync host metadata.
- signalfx
{{- end }}
{{- if (eq (include "splunk-otel-collector.platformMetricsEnabled" .) "true") }}
{{- if $gateway.enabled }}
- otlp
{{- else }}
- splunk_hec/platform_metrics
{{- end }}
{{- end }}
{{- end }}
{{- end }}