Getting Started
This guide explains how to use console-output-datadog
for correlating logs.
Installation
Add the gem to your project:
$ bundle add console
Usage
This output wrapper adds the datadog trace_id
and span_id
to log messages.
> CONSOLE_OUTPUT=Console::Output::Datadog,Console::Output::Default ./example.rb 0.0s warn: Object [oid=0x64] [ec=0x78] [pid=118793] [2021-11-19 18:13:30 +1300] | {"dd":{"trace_id":"602300336988272683","span_id":"351497567211870727"}} | Hello World 0.0s error: Object [oid=0x64] [ec=0x78] [pid=118793] [2021-11-19 18:13:30 +1300] | {"dd":{"trace_id":"602300336988272683","span_id":"351497567211870727"}} | RuntimeError: Boom | → ./example.rb:12 in `block in <main>' | /home/samuel/.gem/ruby/2.7.4/gems/ddtrace-0.54.0/lib/ddtrace/tracer.rb:283 in `trace' | ./example.rb:8 in `<main>'