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

Convert EventId to labels #43

Open
turowicz opened this issue Mar 22, 2021 · 6 comments
Open

Convert EventId to labels #43

turowicz opened this issue Mar 22, 2021 · 6 comments

Comments

@turowicz
Copy link

EventIds are extremely useful when searching through logs for specific events.

Currently they are being pasted as json and the label parser only interprets the first {

image

It would be great if EventId.Id and EventId.Name were parsed as individual labels so we can quickly search through logs using the label indexers.

cc @josephwoodward

@turowicz
Copy link
Author

Adding it as label field pastes the full json in and it's impossible to filter logs by label using the Id or Name:

image

@turowicz
Copy link
Author

turowicz commented Mar 22, 2021

Alternatively you could tell me what would be the LogQL query to get the label that has Id 101, or by name RequestEnd.

@Jexs
Copy link

Jexs commented Apr 13, 2021

I would strongly recommend reading some more about Loki best practices. In your screenshot you show 2 labels consisting of a log level as well as an EventId which both seem to be highly dynamic (EventId more so than log level). Both of these are not recommended for Loki. Here is a great read for more information regarding best practices for labels: https://grafana.com/docs/loki/latest/best-practices/

As for the LogQL, to get ID 101 you can use regex in the label. So something along the lines of: {EventId=~".*Id: 101.*"}

@turowicz
Copy link
Author

@Jexs I understand what you are saying about dynamic labels, but the EventId is already being added by this Nuget library so my suggested change would actually make it much smaller and less dynamic - by replacing the entire JSON with an integer.

@turowicz
Copy link
Author

@Jexs no top of that, my EventIds are not dynamic, but rather static.

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

2 participants