spandex-project/spandex

Log message does not correlate with the trace when trace_id and spand_id are included

IvanRublev opened this issue · 2 comments

What's now:

Having the following lines in config.exs

config :logger, :console,
  format: "$time $metadata[$level] $message\n",
  metadata: [:request_id, :trace_id, :span_id]

The trace produced with no logs associated
Screenshot 2020-09-11 at 11 26 54

same time the trace id and span id are included in the log message.
Screenshot 2020-09-11 at 11 28 03

Seems the format of log message is wrong, it should be dd.trace_id and dd.span_id according to the docs

What's expected

Log record is correlated and visible on the trace page.

You should log as JSON and then configure trace id mapping in the pipeline configuration
image

There is also a place to do this globally, if you don't want to do it specifically for a particular pipeline. It's in the log configuration right after "Ingest API," before all the pipelines.

Please let us know if this fixes it for you! We're just now getting DD Logs set up where I work, so we haven't hit these kinds of issues yet in "real life."

https://app.datadoghq.com/logs/pipelines/remapping

image