Hello, I see that in the built in signoz logs ther...
# support
d
Hello, I see that in the built in signoz logs there are trace_id and span_id fields but they are always empty. How can I enrich my log with the actual trace ids and connect log to trace and vice versa. Thanks!
p
@nitya-signoz may have more insights on this
n
d
Thanks @nitya-signoz. I’m still failing to understand who should be the initiator who should create these span_id and trace_parser fields where and at what point in flow.
n
Okay so your application should create the spans and the logger has to take care that it is adding trace_id and span_id to the logs that are getting generated. If you can describe what stack you are using for your applications we might be able to help you.
d
nestjs
n
So I am assuming that you have already instrumented your application with opentelemtry and already getting traces and spans, but you need that in logs as well.
d
Correct.
Just to ask another question closely related is there any way to view HTTP headers and body in UI trace view?
n
I think you should be able to do that by adding your headers and body as events in the span. @Vishal Sharma correct me if I am wrong here.
v
You can add them as attributes/tags @Devops Netapp
d
Thanks, this is very helpful.
n
Hi @Devops Netapp you can create a logger like this https://github.com/pragmaticivan/nestjs-otel-prom-grafana-tempo/tree/main/src/logger to add traceId and spanId to your logs
We have updated our example as well you can check the changes here https://github.com/SigNoz/sample-NestJs-app/pull/5/files