From f6f3b87efe67b5f2a5004b928a1a2f358a76fac7 Mon Sep 17 00:00:00 2001 From: Rock Baek Date: Tue, 9 Mar 2021 13:01:45 -0800 Subject: [PATCH 01/24] initial test --- .../templates/_config.tpl | 79 +++++++++++++++++++ charts/opentelemetry-collector/values.yaml | 18 ++++- 2 files changed, 96 insertions(+), 1 deletion(-) diff --git a/charts/opentelemetry-collector/templates/_config.tpl b/charts/opentelemetry-collector/templates/_config.tpl index 7937f4b64..0f128c19a 100644 --- a/charts/opentelemetry-collector/templates/_config.tpl +++ b/charts/opentelemetry-collector/templates/_config.tpl @@ -32,6 +32,7 @@ Build config file for agent OpenTelemetry Collector {{- $values := deepCopy .Values.agentCollector | mustMergeOverwrite (deepCopy .Values) }} {{- $data := dict "Values" $values | mustMergeOverwrite (deepCopy .) }} {{- $config := include "opentelemetry-collector.baseConfig" $data | fromYaml }} +{{- $config := include "opentelemetry-collector.agent.containerLogsConfig" $data | fromYaml | mustMergeOverwrite $config }} {{- $config := include "opentelemetry-collector.agentConfigOverride" $data | fromYaml | mustMergeOverwrite $config }} {{- .Values.agentCollector.configOverride | mustMergeOverwrite $config | toYaml }} {{- end }} @@ -121,3 +122,81 @@ service: exporters: [otlp] {{- end }} {{- end }} + +{{- define "opentelemetry-collector.agent.containerLogsConfig" -}} +{{- if .Values.agentCollector.containerLogs.enabled }} +receivers: + filelog: + include: [ /var/log/pods/*/*/*.log ] + start_at: beginning + include_file_path: true + include_file_name: false + operators: + # # Find out which format is used by kubernetes + # - type: router + # id: get-format + # routes: + # - output: parser-docker + # expr: '$$record matches "^\\{"' + # - output: parser-crio + # expr: '$$record matches "^[^ Z]+ "' + # - output: parser-containerd + # expr: '$$record matches "^[^ Z]+Z"' + # # Parse CRI-O format + # - type: regex_parser + # id: parser-crio + # regex: '^(?P