DataDog / serilog-sinks-datadog-logs

Serilog Sink that sends log events to Datadog https://www.datadoghq.com/
Apache License 2.0
62 stars 42 forks source link

Use error.stack for error stacktraces #49

Closed kanadaj closed 5 months ago

kanadaj commented 4 years ago

According to the datadog documentation (https://docs.datadoghq.com/logs/log_collection/?tab=http#how-to-get-the-most-of-your-application-logs) DataDog has the designated error.stack property for stacktraces along with error.message for the exception message, however the serilog logger does not remap to this field automatically. Since Serilog may be used to write to multiple sinks at the same time, it's undesirable to do this mapping in the Enrich pipeline since that would affect the other sinks as well, so the sink itself should be doing this conversion.

kanadaj commented 4 years ago

Ah actually DataDog's own C# pipeline should be responsible for this... I think my data might be lacking a flag for the filter...

kanadaj commented 4 years ago

Apparently this is happening because by default the Newtonsoft.Json serializer uses pascal case instead of camel case, so the resulting exception attribute is Exception, not exception. Datadog's default C# pipeline is case sensitive and defines exception with a lower e.

rafjsouza commented 1 year ago

Apparently this is happening because by default the Newtonsoft.Json serializer uses pascal case instead of camel case, so the resulting exception attribute is Exception, not exception. Datadog's default C# pipeline is case sensitive and defines exception with a lower e.

Hi, did you find any way to solve this?

gh123man commented 1 year ago

Newtonsoft.Json has been removed since 0.4.0 and we have added the ability to fully customize the emitted logs. Let me know if this helps with your problem.

rafjsouza commented 1 year ago

I think so, but shouldn't this work by default? Maybe I'm doing something wrong, but I feel that the sink should already do this

jszwedko commented 5 months ago
Screenshot 2024-05-08 at 4 10 18 PM

The default C# pipeline appears to capture both Exception and exception now. I'll close this, but let me know if it is insufficient for your needs.