diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f15714b99..3791ad2845 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## Unreleased +### Added + +- Add initContainer for log checkpoint migration from Fluentd to Otel agent (#253) + ## [0.37.0] - 2021-10-26 [Upgrade diff --git a/helm-charts/splunk-otel-collector/templates/daemonset.yaml b/helm-charts/splunk-otel-collector/templates/daemonset.yaml index 8d033ff033..c9661555f8 100644 --- a/helm-charts/splunk-otel-collector/templates/daemonset.yaml +++ b/helm-charts/splunk-otel-collector/templates/daemonset.yaml @@ -60,8 +60,9 @@ spec: tolerations: {{ toYaml . | nindent 8 }} {{- end }} - {{- if and (eq (include "splunk-otel-collector.logsEnabled" .) "true") (eq .Values.logsEngine "fluentd") }} + {{- if (eq (include "splunk-otel-collector.logsEnabled" .) "true") }} initContainers: + {{- if (eq .Values.logsEngine "fluentd") }} - name: prepare-fluentd-config image: {{ .Values.image.fluentd.initContainer.image }} imagePullPolicy: {{ .Values.image.fluentd.initContainer.pullPolicy }} @@ -90,6 +91,38 @@ spec: mountPath: /fluentd/etc/json - name: fluentd-config-cri mountPath: /fluentd/etc/cri + {{- else }} + - name: migrate-checkpoint + image: {{ template "splunk-otel-collector.image.otelcol" . }} + imagePullPolicy: {{ .Values.image.otelcol.pullPolicy }} + command: ["/migratecheckpoint"] + securityContext: + runAsUser: 0 + env: + - name: CONTAINER_LOG_PATH_FLUENTD + value: "{{ .Values.fluentd.config.posFilePrefix }}-containers.log.pos" + - name: CONTAINER_LOG_PATH_OTEL + value: "/var/lib/otel_pos/receiver_filelog_" + - name: CUSTOM_LOG_PATH_FLUENTD + value: "{{ .Values.fluentd.config.posFilePrefix }}-*.pos" + - name: CUSTOM_LOG_PATH_OTEL + value: "/var/lib/otel_pos/receiver_filelog_" + - name: CUSTOM_LOG_CAPTURE_REGEX + value: '{{ regexReplaceAll "(\\W)" .Values.fluentd.config.posFilePrefix "\\${1}" }}\-(?P[\w0-9-_]+)\.pos' + - name: JOURNALD_LOG_PATH_FLUENTD + value: "/var/log/splunkd-fluentd-journald-*.pos.json" + - name: JOURNALD_LOG_PATH_OTEL + value: "/var/lib/otel_pos/receiver_journald_" + - name: JOURNALD_LOG_CAPTURE_REGEX + value: '\/splunkd\-fluentd\-journald\-(?P[\w0-9-_]+)\.pos\.json' + volumeMounts: + - name: checkpoint + mountPath: /var/lib/otel_pos + - name: varlog + mountPath: /var/log + - name: varlibdockercontainers + mountPath: /var/lib/docker/containers + {{- end }} {{- end }} containers: {{- if and (eq (include "splunk-otel-collector.logsEnabled" .) "true") (eq .Values.logsEngine "fluentd") }}