I am querying logs from Loki to show their frequency in a dashboard like so:
The error logs are in red, the warning logs in orange and the debug logs in green.
This is just an example I made, there are more logs in the graph
I actually make 3 different queries to get all those logs: (Is there a better way to write my queries?)
The first query for debug logs: count_over_time({filename=~"$Filename", Level=~"Debug", Plan=~"$Plan", JobTitle=~"$JobTitle", Name=~"$Name", Case=~"$Case", Project=~"$Project", User=~"$User", Code=~"$Code"} [$__interval])
The second query for warning logs: count_over_time({filename=~"$Filename", Level=~"Warning", Plan=~"$Plan", JobTitle=~"$JobTitle", Name=~"$Name", Case=~"$Case", Project=~"$Project", User=~"$User", Code=~"$Code"} [$__interval])
The third query for error logs: count_over_time({filename=~"$Filename", Level=~"Error", Plan=~"$Plan", JobTitle=~"$JobTitle", Name=~"$Name", Case=~"$Case", Project=~"$Project", User=~"$User", Code=~"$Code"} [$__interval])
When i query over all the labels (every label on “All”) and i put the time range in 7 days it’s fast, but as I increase the time range it becomes slower and when I put it above 30 days the page crashes and it shows an “Out of memory” error.
Has anyone experienced this? How can I solve this?
Maybe my queries are not efficient?
Thank you