[英]Logs with Pino not showing in Datadog APM trace logs
I'm having trouble getting Pino logs to show up in Datadog APM traces, even though, it would appear that the log injection is working fine.我无法让 Pino 日志显示在 Datadog APM 跟踪中,尽管看起来日志注入工作正常。
So I have dd-trace
all running fine, and traces and spans appearing perfectly in APM.所以我的
dd-trace
运行良好,并且跟踪和跨度在 APM 中完美显示。 I then hook up Pino, I have all env vars set correctly and when my Pino log outputs I can see the trace_id
and span_id
in the log... but under Logs in APM I see nothing.然后我连接 Pino,我正确设置了所有 env var,当我的 Pino 日志输出时,我可以在日志中看到
trace_id
和span_id
......但在 APM 中的日志下,我什么也看不到。
My Pino log looks like this:我的 Pino 日志如下所示:
{
"level":30,
"time":1658480164226,
"pid":20400,
"hostname":"local",
"dd":{
"trace_id":"1314152611599688171",
"span_id":"6560268894829180062",
"service":"datadog-sandbox",
"version":"development",
"env":"development"
},
"foo":"bar",
"msg":"How am I doing?"
}
As you can see, the trace_id
and span_id
have been injected in to the log.如您所见,
trace_id
和span_id
已被注入到日志中。 But when I look at this trace and span in APM I see no logs connected at all:但是,当我在 APM 中查看此跟踪和跨度时,我发现根本没有连接任何日志:
Am I missing some configuration here?我在这里缺少一些配置吗? I'm happy to supply any other code if that helps.
如果有帮助,我很乐意提供任何其他代码。
Thanks谢谢
dd-trace
is just injecting the tracing context into the logs in order to correlate between traces and logs. dd-trace
只是将跟踪上下文注入日志中,以便在跟踪和日志之间建立关联。 It does not send the logs anywhere on its own.它不会自行将日志发送到任何地方。
Logs sending can be achieved by Datadog Agent or directly via HTTP.日志发送可以通过Datadog Agent实现,也可以直接通过HTTP实现。 I was able to make it work with Agentless logging
我能够使其与无代理日志记录一起使用
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.