I am totally new to Grafana/Loki/Prometheus/logql, frankly I am having a very difficult time figuring anything out.
But I have dragged it to this point. I have used promtail to bring in my apache access logs (albeit could not figure out pipeline stages, so am using apache piped logs to transform it and filter out).
I have a small set of log entries about 300.
For this exercise I want to just count how many 500 errors.
In grafana, I have setup a panel with logs display, using this logql
{job="apache_access"} | json | status = "500"
That displays in the log type display my entries.
So I switch to stat display and try to change it to:
count({job="apache_access"} | json | status = "500")
And it says: parse error at line 1, col 52: syntax error unexpected )
Count is a legit metric according to the logql manual, what am I doing wrong?
It took some time to understand LogQL and I am by no means an expert… I tried a similar query to yours and got the same error. Seems like you can only use count on an other aggregation.
Not sure if I can help much more than that… One thing I can say is that the json parser will slow things down quite a bit and can report many parsing errors.