From 4d208fbe9d0ae4bbc1099e581fed8b5e2226c3af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20=C5=9Awi=C4=85tek?= Date: Thu, 14 Jul 2022 17:58:38 +0200 Subject: [PATCH] feat: refactor OT logging configuration --- .../conf/logs/collector/otelcol/config.yaml | 246 +++++++++++- deploy/helm/sumologic/templates/_helpers.tpl | 26 +- .../logs/collector/otelcol/configmap.yaml | 8 +- .../logs/collector/otelcol/daemonset.yaml | 8 +- .../logs/collector/otelcol/service.yaml | 2 +- .../collector/otelcol/serviceaccount.yaml | 2 +- deploy/helm/sumologic/values.yaml | 355 ++++-------------- tests/helm/logs_otc/static/basic.input.yaml | 4 +- tests/helm/logs_otc/static/basic.output.yaml | 1 - .../static/basic.input.yaml | 4 +- .../static/complex.input.yaml | 4 +- .../values/values_helm_otelcol_logs.yaml | 27 +- 12 files changed, 358 insertions(+), 329 deletions(-) diff --git a/deploy/helm/sumologic/conf/logs/collector/otelcol/config.yaml b/deploy/helm/sumologic/conf/logs/collector/otelcol/config.yaml index 1df67f5cdf..f9187519e3 100644 --- a/deploy/helm/sumologic/conf/logs/collector/otelcol/config.yaml +++ b/deploy/helm/sumologic/conf/logs/collector/otelcol/config.yaml @@ -1 +1,245 @@ -{{ tpl (toYaml .Values.otellogs.config | replace ": '{{" ": {{" | replace "}}'" "}}") . | nindent 2 }} +extensions: + health_check: {} +{{- if .Values.sumologic.logs.persistence.enabled }} + file_storage: + directory: {{ .Values.sumologic.logs.persistence.storageDirectory }} + timeout: 10s +{{- end }} + pprof: {} +service: + telemetry: + logs: + level: {{ .Values.otellogs.logLevel | quote }} + extensions: + - health_check +{{- if .Values.sumologic.logs.persistence.enabled }} + - file_storage +{{- end }} + - pprof + pipelines: + logs/containers: + receivers: + - filelog/containers + processors: + - batch + exporters: + - otlphttp +{{- if .Values.sumologic.logs.systemd.enabled }} + logs/systemd: + receivers: + - journald + processors: + - logstransform/systemd + - batch + exporters: + - otlphttp +{{- end }} +receivers: + filelog/containers: + include: + - /var/log/pods/*/*/*.log + start_at: beginning + ## sets fingerprint_size to 17kb in order to match the longest possible docker line (which by default is 16kb) + ## we want to include timestamp, which is at the end of the line + fingerprint_size: 17408 + include_file_path: true + include_file_name: false + operators: + ## Detect the container runtime log format + ## Can be: docker-shim, CRI-O and containerd + - id: get-format + type: router + routes: + - output: parser-docker + expr: 'body matches "^\\{"' + - output: parser-crio + expr: 'body matches "^[^ Z]+ "' + - output: parser-containerd + expr: 'body matches "^[^ Z]+Z"' + ## Parse CRI-O format + - id: parser-crio + type: regex_parser + regex: '^(?P