diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000..3018b3a68 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.tmp/ diff --git a/charts/opentelemetry-collector/Chart.yaml b/charts/opentelemetry-collector/Chart.yaml index c5521213e..d3b600887 100644 --- a/charts/opentelemetry-collector/Chart.yaml +++ b/charts/opentelemetry-collector/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: opentelemetry-collector -version: 0.4.3 +version: 0.5.0 description: OpenTelemetry Collector Helm chart for Kubernetes type: application home: https://opentelemetry.io/ @@ -13,4 +13,4 @@ maintainers: - name: pjanotti - name: tigrannajaryan icon: https://opentelemetry.io/img/logos/opentelemetry-logo-nav.png -appVersion: 0.20.0 +appVersion: 0.22.0 diff --git a/charts/opentelemetry-collector/templates/_config.tpl b/charts/opentelemetry-collector/templates/_config.tpl index 7937f4b64..042f04545 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,116 @@ service: exporters: [otlp] {{- end }} {{- end }} + +{{- define "opentelemetry-collector.agent.containerLogsConfig" -}} +{{- if .Values.agentCollector.containerLogs.enabled }} +receivers: + filelog: + include: [ /var/log/pods/*/*/*.log ] + {{- if not .Values.agentCollector.containerLogs.includeAgentLogs }} + exclude: [ /var/log/pods/{{ .Release.Namespace }}_{{ include "opentelemetry-collector.fullname" . }}-agent-*_*/{{ .Chart.Name }}/*.log ] + {{- end }} + start_at: beginning + include_file_path: true + include_file_name: false + operators: + {{- if eq .Values.agentCollector.containerLogs.containerRunTime "cri-o" }} + # Parse CRI-O format + - type: regex_parser + id: parser-crio + regex: '^(?P