-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
grafana-loki lacks basic feature of extracting nested json labels #6994
Comments
Hi @sschmiedleitner loki/clients/cmd/fluent-bit/loki.go Lines 160 to 179 in da6fd01
Maybe you want to give it a try to implement a recursive label extraction, e.g. using dot as object separator? |
@chaudum Sorry, but not my language ;-) |
@sschmiedleitner No problem. I marked the issue as |
@sschmiedleitner you could also use the |
Hello @chaudum. I decided to try to investigate this issue and find a good solution using the recursive method as you described above, and hopefully I found it. Could you take a look at my example of an implemented solution? If it seems right to you, I would be happy to open PR. If not, I'll try to find a better solution, so feel free to assign this issue to me if possible. :) |
actually I tried to avoid building an extra image as it is extra effort to find a proper place to put it etc. but anyways I made already a different workaround (rather not extracting that many labels). but still my topic is valid maybe for others. |
Hi @chaudum, I see in the code that it is not resolved yet, can I potentially work on it? |
I think more people run into this extra JSON parsing. Example Query: |
I would love to see this feature as well, since I'm running into it. It would also be nice if it could parse a JSON object agnostic of whether it's been stringified or not. |
You are supposed to parse those nested_logs using for example vector's In case you prefer this kind of logs analytics (index all fields for searches) - Loki is not really a good option for you and you should probably look at different logging platforms i.e. Opensearch or Betterstack. |
Is your feature request related to a problem? Please describe.
I am running a java spring-boot application on AWS ECS and want to ship logs to loki/grafana. In order to have the java stack trace as a single log line in grafana I log as json to console using
The resulting json from AWS ECS looks like this:
Describe the solution you'd like
I want to extract also lables from the log element, i.e. log level, logger name, ... and only keep the log.message as the log text.
So therefore I need configuration like this (cloudformation yaml config), which is currently not working/supported:
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
I have also tried using LabelMapPath, but this didn't work either. Also tried LineFormat=json but has same result.
Additional context
This is really a basic feature I bet a lot of people need!
And maybe another option would be great to specify the final message target, i.e. "log.message" in my case... and other properties should be ignored. Would extremly ease the config avoiding the need of specifying tons of "RemoveKeys"...
The text was updated successfully, but these errors were encountered: