Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Each error/log in Datadog is broken down into 1 entry for each line of the error stack instead of 1 error with a full log of the entire error stack. #1170

Closed
gkatsanos opened this issue Dec 14, 2020 · 10 comments
Labels
community question Further information is requested

Comments

@gkatsanos
Copy link

Describe the bug
Each error/log in Datadog is broken down into 1 entry for each line of the error stack instead of 1 error with a full log of the entire error stack.

image

Environment
Production

  • Operation system:
    Linux

  • Node version:
    14.14

  • Tracer version:
    Latest

  • Agent version:

@gkatsanos gkatsanos added the bug Something isn't working label Dec 14, 2020
@rochdev rochdev added community question Further information is requested and removed bug Something isn't working labels Dec 14, 2020
@rochdev
Copy link
Member

rochdev commented Dec 14, 2020

This library generates traces but doesn't handle logging outside of APM. For help regarding the Log Management product I would recommend contacting support or asking in the public Slack. Generally speaking, each line of the log output will becomes its own entry.

@rochdev rochdev closed this as completed Dec 14, 2020
@gkatsanos
Copy link
Author

Thank you for the Slack link :) Just to clarify, so with regards to the Datadog platform, this library only deals with the APM part? I was under the impression all views are based on the same data and I thought the way dd-trace-js emits the data (the format) plays a role in how the logs are shown everywhere.

@rochdev
Copy link
Member

rochdev commented Dec 15, 2020

Yes, it's only the APM part. For the logs, they're either sent to the agent directly from the app using a transport on your logger of choice (for example winston) or sent to stdout and then the agent would pick them up and forward them to Datadog. In both cases, every line from the log will appear as its own entry. There are ways to combine lines together in the pipeline, but that could give you mixed results. Doing this at the source, for example using JSON instead of raw text as the output, would definitely be better and would also be parsed correctly by the pipeline to split each attribute from the JSON as its own tag.

@gkatsanos
Copy link
Author

Doing this at the source, for example using JSON instead of raw text as the output

How does one do that? What's the "Source" ?

@rochdev
Copy link
Member

rochdev commented Dec 15, 2020

I meant directly at the logger level in the service. What logger are you using?

@gkatsanos
Copy link
Author

I think these logs are generated on the framework level so I'm not sure we have access to its' logging library/mechanism, but I just looked and they use https://www.npmjs.com/package/consola . Is there a way to add a logging middleware which handles these and converts them? Which logger should we use in general to send JSON format errors?

@rochdev
Copy link
Member

rochdev commented Dec 15, 2020

Generally speaking we recommend using either Winston, Bunyan or Pino since they are the most popular loggers out there and also are supported for our log injection feature. I'm not familiar enough with Nuxt to know if it's best practice to provide your own logger or stick to Consola though.

It does look like Consola has an available JSON reporter. Configuring it to use that reporter, at least in non-local environments, would definitely give you a better logging experience.

I also created #1172 to track log injection support for Consola.

@gkatsanos
Copy link
Author

awesome. I guess #1172 will solve our problem :-)

@rochdev
Copy link
Member

rochdev commented Dec 15, 2020

#1172 is a different feature (being able to connect logs and traces together) but won't solve the multiple lines issue, which would still require altering the format as described above.

@gkatsanos
Copy link
Author

I guess I won't be able to change the source code of the node module in question (the error is thrown in the frameworks context). Maybe I can catch it and relog / reformat it on our code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants