'Loki parse JSON and filter by field
I'm logging a JSON which is being shown as a detected field log in Grafana:
Now I want to filter the logs by level name, but I can't figure out how...
I thought something like this would work, but doesn't, no results are returned:
{app="hello"} | json | line_format "{{.log}}" | levelname="ERROR"
What am I missing?
Solution 1:[1]
Everything is Ok with the LogQL, but something is wrong with your JSON log line. You should have several detected fields (like "asctime", "created", "filename", etc) instead of just the "log" one, and you also should have the "Log labels" section.
Maybe you should start verifying why the quotes are escaped with ""?
See a working example following:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Marcelo Ãvila de Oliveira |

