Is it possible to auto instrument nodejs logs in s...
# support
n
Is it possible to auto instrument nodejs logs in signoz using winston module?
h
I believe the Winston hooks are in the
auto-instrumentation
system if you're already able to use auto-instrumentation (package or k8s operator): https://www.npmjs.com/package/@opentelemetry/instrumentation-winston In my case, since I'm using NestJS I had to use
nest-winston
to replace Nest's default logger with Winston, then the above module will add the
winston-transport
and now you'll get Logs that are automatically correlated to Traces with a
trace.id
attribute.
If you're using signoz-k8s-infra, make sure to remove your pod from the scraped pod logs otherwise you'll get duplicates.
n
I am using docker-swarm infra for node js instrumentation. Does this suggested document will help in my case ? Kindly suggest.
h
I don't think Docker Swarm has an operator like Kubernetes to automatically inject the auto-instrumentation, so you'll need to at minimum add this: https://signoz.io/docs/instrumentation/opentelemetry-javascript/#send-traces-directly-to-signoz-cloud---n[…]de-automatic-instrumentation-recommended If your main app is already using Winston then that should forward Winston events to Signoz. So asides from adding those packages and
tracing.js
, there is not extensive changes to your app.