forked from signalfx/splunk-otel-collector-chart
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically detect container runtime and apply relevant parsing con…
…fig (signalfx#154) This change makes transition from deprecated docker to containerd runtime not disruptive. Otherwise, users have to change criTimeFormat property and upgrade the chart release after they upgraded k8s cluster to a new version.
- Loading branch information
Showing
49 changed files
with
390 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
helm-charts/splunk-otel-collector/templates/configmap-fluentd-cri.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
{{ if and .Values.logsEnabled .Values.otelAgent.enabled }} | ||
{{/* | ||
Fluentd config parts applied only to clusters with containerd/cri-o runtime. | ||
*/}} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "splunk-otel-collector.fullname" . }}-fluentd-cri | ||
labels: | ||
app: {{ template "splunk-otel-collector.name" . }} | ||
chart: {{ template "splunk-otel-collector.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
data: | ||
|
||
source.containers.parse.conf: |- | ||
@type regexp | ||
expression /^(?<time>.+) (?<stream>stdout|stderr)( (?<partial_flag>[FP]))? (?<log>.*)$/ | ||
time_format {{ .Values.fluentd.config.containers.criTimeFormat }} | ||
output.concat.conf: |- | ||
# = handle cri/containerd multiline format = | ||
<filter tail.containers.var.log.containers.**> | ||
@type concat | ||
key log | ||
partial_key partial_flag | ||
partial_value P | ||
separator '' | ||
timeout_label @SPLUNK | ||
</filter> | ||
output.transform.conf: |- | ||
# extract pod_uid and container_name for CRIO runtime | ||
# currently CRI does not produce log paths with all the necessary | ||
# metadata to parse out pod, namespace, container_name, container_id. | ||
# this may be resolved in the future by this issue: https://github.com/kubernetes/kubernetes/issues/58638#issuecomment-385126031 | ||
<filter tail.containers.var.log.pods.**> | ||
@type jq_transformer | ||
jq '.record | . + (.source | capture("/var/log/pods/(?<pod_uid>[^/]+)/(?<container_name>[^/]+)/(?<container_retry>[0-9]+).log")) | .sourcetype = ("kube:container:" + .container_name)' | ||
</filter> | ||
# rename pod_uid and container_name to otel semantics. | ||
<filter tail.containers.var.log.pods.**> | ||
@type record_transformer | ||
<record> | ||
k8s.pod.uid ${record["pod_uid"]} | ||
k8s.container.name ${record["container_name"]} | ||
</record> | ||
</filter> | ||
{{- end }} |
22 changes: 22 additions & 0 deletions
22
helm-charts/splunk-otel-collector/templates/configmap-fluentd-json.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{{ if and .Values.logsEnabled .Values.otelAgent.enabled }} | ||
{{/* | ||
Fluentd config parts applied only to clusters with docker runtime. | ||
*/}} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ template "splunk-otel-collector.fullname" . }}-fluentd-json | ||
labels: | ||
app: {{ template "splunk-otel-collector.name" . }} | ||
chart: {{ template "splunk-otel-collector.chart" . }} | ||
release: {{ .Release.Name }} | ||
heritage: {{ .Release.Service }} | ||
data: | ||
source.containers.parse.conf: |- | ||
@type json | ||
time_format %Y-%m-%dT%H:%M:%S.%NZ | ||
output.filter.conf: "" | ||
|
||
output.transform.conf: "" | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
# Source: splunk-otel-collector/templates/configmap-fluentd-cri.yaml | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: default-splunk-otel-collector-fluentd-cri | ||
labels: | ||
app: splunk-otel-collector | ||
chart: splunk-otel-collector-0.26.2 | ||
release: default | ||
heritage: Helm | ||
data: | ||
|
||
source.containers.parse.conf: |- | ||
@type regexp | ||
expression /^(?<time>.+) (?<stream>stdout|stderr)( (?<partial_flag>[FP]))? (?<log>.*)$/ | ||
time_format %Y-%m-%dT%H:%M:%S.%N%:z | ||
output.concat.conf: |- | ||
# = handle cri/containerd multiline format = | ||
<filter tail.containers.var.log.containers.**> | ||
@type concat | ||
key log | ||
partial_key partial_flag | ||
partial_value P | ||
separator '' | ||
timeout_label @SPLUNK | ||
</filter> | ||
output.transform.conf: |- | ||
# extract pod_uid and container_name for CRIO runtime | ||
# currently CRI does not produce log paths with all the necessary | ||
# metadata to parse out pod, namespace, container_name, container_id. | ||
# this may be resolved in the future by this issue: https://github.com/kubernetes/kubernetes/issues/58638#issuecomment-385126031 | ||
<filter tail.containers.var.log.pods.**> | ||
@type jq_transformer | ||
jq '.record | . + (.source | capture("/var/log/pods/(?<pod_uid>[^/]+)/(?<container_name>[^/]+)/(?<container_retry>[0-9]+).log")) | .sourcetype = ("kube:container:" + .container_name)' | ||
</filter> | ||
# rename pod_uid and container_name to otel semantics. | ||
<filter tail.containers.var.log.pods.**> | ||
@type record_transformer | ||
<record> | ||
k8s.pod.uid ${record["pod_uid"]} | ||
k8s.container.name ${record["container_name"]} | ||
</record> | ||
</filter> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
# Source: splunk-otel-collector/templates/configmap-fluentd-json.yaml | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: default-splunk-otel-collector-fluentd-json | ||
labels: | ||
app: splunk-otel-collector | ||
chart: splunk-otel-collector-0.26.2 | ||
release: default | ||
heritage: Helm | ||
data: | ||
source.containers.parse.conf: |- | ||
@type json | ||
time_format %Y-%m-%dT%H:%M:%S.%NZ | ||
output.filter.conf: "" | ||
|
||
output.transform.conf: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.