open-telemetry / opentelemetry-collector

OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
4.46k stars 1.47k forks source link

Emit collector JSON logs with the message attribute #10612

Open clintonb opened 4 months ago

clintonb commented 4 months ago

Is your feature request related to a problem? Please describe.

Datadog and Google use the message attribute as the main body of the log message. This value is used for basic search and log tailing.

Usage of the msg attribute by the collector makes log spelunking a bit tedious.

Describe the solution you'd like

There are a few options:

  1. Only use the message attribute.
  2. Use both the message and msg attributes.
  3. Allow the attribute to be defined via configuration. For example:
    service:
    telemetry:
    logs:
      encoding: json
      body_attribute: message
clintonb commented 4 months ago

Related: https://github.com/open-telemetry/opentelemetry-collector/issues/4740#issuecomment-1440747441

atoulme commented 4 months ago

We could dxpose zapcore.EncoderConfig. You can override messageKey then.

TylerHelmuth commented 4 months ago

Ultimately the collectors telemetry will follow OpenTelemetry Semantic conversions. Those haven't yet been decided for the collector, but the conversation has started.