Grafana unable to connect to Loki

Grafana cannot connect to loki as a data source however I can shell into the grafana pod and connect to loki.

$ curl http://loki:3100/ready
ready

I see this error message in the grafana logs.

Host=loki:3100 lokiPath=/loki/api/v1/query status=error error=“parse error at line 1, col 1: syntax error: unexpected IDENTIFIER”
logger=tsdb.loki endpoint=checkHealth pluginId=loki dsName=Loki dsUID=edca2408-8616-4c2a-b6eb-954aa51980db uname=admin fromAlert=false t=2023-12-28T18:45:43.266236468Z level=error msg=“Error querying loki” error=“parse error at line 1, col 1: syntax error: unexpected IDENTIFIER”

Hi @sawatson,

Could you share which version of Loki and Grafana are you using?
And If applicable, which helm chart?

There’s a recent issue similar in the Grafana repo and it’s related to the Loki-stack helm chart version.
Link here: Grafana Loki Integration: Health check fails when Loki is up and functional · Issue #79846 · grafana/grafana · GitHub

I believe that’s the issue.

NAME CHART APP VERSION
loki loki-stack-2.9.11 v2.6.1

I was able to get it working by removing grafana and enabling Grafana that’s included in the loki-stack.

1 Like