Grafana - Loki datasource returns 401 - no org id

Summary

Errors in grafana pod:

logger=tsdb.loki endpoint=CheckHealth endpoint=checkHealth pluginId=loki dsName=Loki dsUID=P8E80F9AEF21F6940 uname=sylva-admin@example.com
fromAlert=false t=2025-05-15T09:02:09.024412387Z level=info msg="Prepared request to Loki" duration=58.545µs queriesLength=1 stage=prepareRequest runInParallel=false
logger=tsdb.loki endpoint=CheckHealth endpoint=checkHealth pluginId=loki dsName=Loki dsUID=P8E80F9AEF21F6940 uname=sylva-admin@example.com
 fromAlert=false t=2025-05-15T09:02:09.107957748Z level=error msg="Error received from Loki"
 duration=83.452241ms stage=databaseRequest statusCode=401 contentLength=10 start=1970-01-01T00:00:01Z end=1970-01-01T00:00:04Z step=1s
  query=vector(1)+vector(1) queryType=instant direction=backward maxLines=0 supportingQueryType=none
  lokiHost=loki-gateway.loki.svc.cluster.local lokiPath=/loki/api/v1/query status=error error="no org id\n" statusSource=downstream

logger=tsdb.loki endpoint=CheckHealth t=2025-05-15T09:02:09.108025241Z level=error msg="Loki health check failed" error="error from loki: no org id\n"
logger=context userId=2 orgId=1 uname=sylva-admin@example.com t=2025-05-15T09:02:09.108093934Z level=info msg="Request Completed"
 method=GET path=/api/datasources/uid/P8E80F9AEF21F6940/health status=400 remote_addr=172.18.0.4 time_ms=90 duration=90.300489ms size=106
 referer=https://grafana.sylva/connections/datasources/edit/P8E80F9AEF21F6940 handler=/api/datasources/uid/:uid/health status_source=server

and in loki-gateway:

100.72.190.207 - management-cluster [15/May/2025:09:04:47 +0000]  401 "GET /loki/api/v1/query?direction=backward&query=vector%281%29%2Bvector%281%29&time=4000000000 HTTP/1.1" 10 "-" "Grafana/11.1.0" "-"

This breaks the datasource in grafana, and no logs can be seen because of it.

related references

Details

Edited May 15, 2025 by Mihai Zaharia
Assignee Loading
Time tracking Loading