My setup: Loki: 2.1.0, Grafana: 6.7.3
My software runs on Kubernetes, Loki collects its logs. It looks something like this:
[2021-03-29 10:13:05] [INFO] Q_len=256 sol_q=0.049 info_q=0.240
[2021-03-29 10:13:05] [INFO] Q_len=196 sol_q=0.047 info_q=0.144
I used logfmt in the logs, so loki can detect my fields:
Now I want info_q
's avg value plotted over time on Grafana. Here are the things I tried:
avg by (info) (avg_over_time({job="ism/ism-core-es"} | regexp `.*info_q=(?P<info_q>.*)` | unwrap info_q [1m]))
As the error message suggested, l did
avg by (info) (avg_over_time({job="ism/ism-core-es"} | regexp `.*info_q=(?P<info_q>.*)` | unwrap info_q | __error__="" [1m] ))
which returns empty chart. And this
avg_over_time(
{job="ism/ism-core-es"}
| regexp ".*info_q=(?P<info_q>.*?)"
| unwrap info_q [5m])
returns nothing either.
What am I doing wrong? Do I have to type cast? Any help is appreciated!