How to allow Grafana to connect to Loki

What Grafana version and OS :
Grafana version: Grafana 6.6.1
OS: Amazon Linux 2

What are you trying to achieve?

  • See loki logs in grafana

How are you trying to achieve it?

  • We are using nginx for proxy, docker-compose to install all components

What happened?

  • Currently, loki is successfully installed and promtail can send logs into Loki based off docker logs. However, grafana cannot connect to loki from Datasources whenever we try to add it.
    Error is
    Loki: Forbidden. 403 Access Denied

What did you expect to happen?

  • Datasource test will be working successfully and we’ll be able to expose logs scraped by promtail into loki.

Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.

  • Loki: Forbidden. 403 Access Denied

Did you follow any online instructions?

Just wanted to ask how do you normally set up Loki and Grafana via docker-compose?

Can you share your nginx config and how you’re entering the Loki address in Grafana data source ?

You need to update the address in Grafana to nginx’s address, like : http://nginx:80.

Thanks for the response!

Sorry if I deleted the first reply as it wasn’t formatted right. Please see photo attached.

*image is latest for nginx, just didnt put it in the screenshot
*Grafana is mapped to 80 in nginx

All resolved now! Had to remove the default network to make it work

1 Like