EKS 1.23, Prometheus-stack with Grafana v7.3.5
Installed Loki v2.7.3 and now trying to connect Grafana to Loki.
I added Loki datasource from Grafana and configured the loki-gateway
service url:
Then I get the following error:
Loki: Bad Request. 400. Authentication to data source failed
From loki-gateway pod’s logs:
10.7.60.60 - - [01/Mar/2023:14:18:53 +0000] 401 "GET /loki/api/v1/label?start=1677679732842000000 HTTP/1.1" 10 "-" "Grafana/7.3.5" "10.7.127.117, 10.0.60.21, 10.0.60.21"
NOTE: loki-gateway basicAuth
is disabled by default, hence no need to add user & password to Loki data source in Grafana.
Tried:
-
Enable loki-gateway
basicAuth
and pass the credentials through Grafana Loki Data Source. -
Skip tls verification
Both ended up with the same error.
2
Answers
If you are using loki helm chart to deploy, check if
auth_enabled
value is set to true (it’s true by default), set it false and upgrade.I got the same promblem, then i check grafana log
it shows
You can specify the orgid by adding an HTTP Header ‘X-Scope-OrgID’ in the Data Source configuration on the Grafana panel. Here, you can set the value of the Header to the orgid you want. This way, when Grafana proxies access to Loki’s API, it will have the correct Header and thus successfully authenticate and obtain access.