Getting the OpenTelemetry Collector logs

Obtaining logs from the OpenTelemetry Collector is essential for diagnosing issues. You can troubleshoot problems in data collection and processing by configuring log levels and viewing the Collector pod logs.

Setting the log level

You can set the appropriate log level in the OpenTelemetryCollector custom resource:

config:
  service:
    telemetry:
      logs:
        level: debug

Log level descriptions

The Collector supports the following log levels:

  • debug: Detailed debugging information, suitable for in-depth troubleshooting
  • info: General informational logs, default level
  • warn: Warning messages
  • error: Error messages
TIP

In production environments, it is recommended to use the info level. Only use the debug level when detailed diagnostic information is needed, as it generates substantial log output.

Viewing the Collector logs

After configuring the log level, you can view the Collector logs using the following command:

kubectl logs <collector-pod-name> -n <namespace>

If the Collector runs in Deployment mode, you can view logs from all replicas:

kubectl logs -l app.kubernetes.io/name=otel-collector -n opentelemetry-collector