Loki LogQL log count graphing doesn't work

When I try to create a dashboard graph with: rate(({app_kubernetes_io_name="nginx"} |= "ERROR")[10s]) and I look at the query inspector, I get: legacy endpoints only support streams result type, current type is matrix. Should this work with Graphana yet? The loki docs have this feature documented here: https://github.com/grafana/loki/blob/master/docs/logql.md#range-vector-aggregation

Ok, it seems like all that is needed is to open a Prometheus datasource and add /loki to the loki endpoint used for the logs, and then it works!

1 Like

I tried the same, however, when I am trying to run some query in the explore page, it always says ā€œloading metricsā€¦ā€, hence not able to run any query successfully.

Anyone has the same issue?

image

1 Like

I am in the same state.
I cannot execute a query on the explore page.
However, the panel query can be executed and the graph is displayed.
This may be caused by registering Loki as Prometheus, but I do not know how to solve it.

Could you please describe in more detail, how did you configure it? I cannot make it work. I.e. I canā€™t follow the ā€˜open a Prometheus datasource and add /loki to the loki endpoint used for the logsā€™. Thank you.

You need to create a prometheus datasource (not Loki) and use http://localhost:3100/loki as url. The Loki datasource uses an deprecated api.

Btw, you need 2 datasources atm (Jan 2020 / Grafana 6.5.2 / Loki 1.2). A Prometheus datasource for rate() and such things usable in graphs. And a Loki datasource usable in the Grafana Explorer.

1 Like