@@ -25,9 +25,9 @@ helm install my-opentelemetry-collector open-telemetry/opentelemetry-collector
25
25
26
26
### Default configuration
27
27
28
- By default this chart will deploy an OpenTelemetry Collector as daemonset with two pipelines (traces and metrics )
28
+ By default this chart will deploy an OpenTelemetry Collector as daemonset with three pipelines (logs, metrics and traces )
29
29
and logging exporter enabled by default. Besides daemonset (agent), it can be also installed as standalone deployment.
30
- Both modes can be enabled together, in that case metrics and traces will be flowing from agents to standalone collectors.
30
+ Both modes can be enabled together, in that case logs, metrics and traces will be flowing from agents to standalone collectors.
31
31
32
32
* Example* : Install collector as a standalone deployment, and do not run it as an agent.
33
33
@@ -42,6 +42,7 @@ By default collector has the following receivers enabled:
42
42
43
43
- **metrics**: OTLP and prometheus. Prometheus is configured only for scraping collector's own metrics.
44
44
- **traces**: OTLP, zipkin and jaeger (thrift and grpc).
45
+ - **logs**: OTLP (to enable container logs, see [Configuration for Kubernetes container logs](#configuration-for-kubernetes-container-logs)).
45
46
46
47
There are two ways to configure collector pipelines, which can be used together as well.
47
48
@@ -107,6 +108,76 @@ agentCollector:
107
108
mountPropagation: HostToContainer
108
109
` ` `
109
110
111
+ # ## Configuration for Kubernetes container logs
112
+
113
+ The collector can be used to collect logs sent to standard output by Kubernetes containers.
114
+ This feature is disabled by default. It has the following requirements :
115
+
116
+ - It needs agent collector to be deployed, which means it will not work if only standalone collector is enabled.
117
+ - It requires the [contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib) version
118
+ of the collector image.
119
+
120
+ To enable this feature, set the `agentCollector.containerLogs.enabled` property to `true` and replace the collector image.
121
+ Here is an example `values.yaml` :
122
+
123
+ ` ` ` yaml
124
+ agentCollector:
125
+ containerLogs:
126
+ enabled: true
127
+
128
+ image:
129
+ repository: otel/opentelemetry-collector-contrib
130
+
131
+ command:
132
+ name: otelcontribcol
133
+ ` ` `
134
+
135
+ The way this feature works is it adds a `filelog` receiver on the `logs` pipeline. This receiver is preconfigured
136
+ to read the files where Kubernetes container runtime writes all containers' console output to.
137
+
138
+ # ### :warning: Warning: Risk of looping the exported logs back into the receiver, causing "log explosion"
139
+
140
+ The container logs pipeline uses the `logging` console exporter by default.
141
+ Paired with the default `filelog` receiver that receives all containers' console output,
142
+ it is easy to accidentally feed the exported logs back into the receiver.
143
+
144
+ Also note that using the `--log-level=debug` option for the `logging` exporter causes it to output
145
+ multiple lines per single received log, which when looped, would amplify the logs exponentially.
146
+
147
+ To prevent the looping, the default configuration of the receiver excludes logs from the collector's containers.
148
+
149
+ If you want to include the collector's logs, make sure to replace the `logging` exporter
150
+ with an exporter that does not send logs to collector's standard output.
151
+
152
+ Here's an example `values.yaml` file that replaces the default `logging` exporter on the `logs` pipeline
153
+ with an `otlphttp` exporter that sends the container logs to `https://example.com:55681` endpoint.
154
+ It also clears the `filelog` receiver's `exclude` property, for collector logs to be included in the pipeline.
155
+
156
+ ` ` ` yaml
157
+ agentCollector:
158
+ containerLogs:
159
+ enabled: true
160
+
161
+ configOverride:
162
+ exporters:
163
+ otlphttp:
164
+ endpoint: https://example.com:55681
165
+ receivers:
166
+ filelog:
167
+ exclude: []
168
+ service:
169
+ pipelines:
170
+ logs:
171
+ exporters:
172
+ - otlphttp
173
+
174
+ image:
175
+ repository: otel/opentelemetry-collector-contrib
176
+
177
+ command:
178
+ name: otelcontribcol
179
+ ` ` `
180
+
110
181
# ## Other configuration options
111
182
112
183
The [values.yaml](./values.yaml) file contains information about all other configuration
0 commit comments