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

Possibility to include both @m and @mt in json #33

Closed
videokojot opened this issue May 27, 2020 · 5 comments
Closed

Possibility to include both @m and @mt in json #33

videokojot opened this issue May 27, 2020 · 5 comments

Comments

@videokojot
Copy link

Currently we can decide only either having the rendered message or the message template. For us it would be useful, to include both of those in the json, since it would tremendously simplified filtering and searching of logs in elastic search/kibana. It would allow us to easily filter out non interesting events by the message template, when digging in logs, while still keeping the benefit of having rendered message (better readibility).

@sungam3r
Copy link
Contributor

I also asked such a question, but in the end I did not use @m in favor of @mt. Although your suggestion makes sense.

@nblumhardt
Copy link
Member

@videokojot did you spot @i in the rendered version? It's usually enough to stand in for the message template (it's a hash of @mt). HTH!

@videokojot
Copy link
Author

Sorry for late response. @nblumhardt thank you for the suggestion. That good for filtering, but not so much for the searching of the message.

In the end we ended up copying-modifying the RenderedCompactJson and adding the @mt property.

https://github.com/serilog/serilog-formatting-compact/blob/dev/src/Serilog.Formatting.Compact/Formatting/Compact/RenderedCompactJsonFormatter.cs

Thank you very much. Should I close?

@nblumhardt
Copy link
Member

Thanks 👍

@nblumhardt
Copy link
Member

JSON formatting with ExpressionTemplate can do this, now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants