Unable to get Grafana to connect to Loki

I’m a total newbie, going through the Grafana for Beginners tutorial series.
I’ve installed the Grafana 11.3.1 Stand alone enterprise on Windows 10.

I’ve gotten to the plug in section and attempting to add the Loki datastore. Tried to carefully follow the instructions from Grafana docs step by step.

URL: http://localhost:3100
Basic authentication
User: admin
Password: admin
Skip TLS certificate validation
Nothing set for HTTP headers

All Additional settings left default

When I click Save & test I get:
Unable to connect with Loki. Please check the server logs for more details.

I found a grafana.log in grafana-v113.1.1\data\log
I’m assuming that is the log it is referring to. Found this:

logger=tsdb.loki endpoint=CheckHealth endpoint=checkHealth pluginId=loki dsName=loki-RH dsUID=ae5xrfwfz91q8c uname=admin fromAlert=false t=2024-12-05T15:33:15.0049704-05:00 level=error msg=“Error received from Loki” error=“Get “http localhost:3100/loki/api/v1/query?direction=backward&query=vector%281%29%2Bvector%281%29&time=4000000000”: dial tcp 127.0.0.1:3100: connectex: No connection could be made because the target machine actively refused it.” status=error duration=3.6994ms stage=databaseRequest 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=localhost:3100 lokiPath=/loki/api/v1/query
logger=tsdb.loki endpoint=CheckHealth t=2024-12-05T15:33:15.0057016-05:00 level=error msg=“Loki health check failed” error=“error from loki: Get “[http://localhost:3100/loki/api/v1/query?direction=backward&query=vector(1)%2Bvector(1)&time=4000000000\](http://localhost:3100/loki/api/v1/query?direction=backward&query=vector(1)%2Bvector(1)&time=4000000000\)”: dial tcp 127.0.0.1:3100: connectex: No connection could be made because the target machine actively refused it.”
logger=context userId=1 orgId=1 uname=admin t=2024-12-05T15:33:15.006237-05:00 level=info msg=“Request Completed” method=GET path=/api/datasources/uid/ae5xrfwfz91q8c/health status=400 remote_addr=[::1] time_ms=9 duration=9.2862ms size=106 referer=http
//pl2usmif0686v0:3000/connections/datasources/edit/ae5xrfwfz91q8c handler=/api/datasources/uid/:uid/health status_source=server

I cannot figure out what I’m doing wrong.
Any suggestions greatly appreciated.

It looks like you're encountering a connection issue between Grafana and Loki. The error message "No connection could be made because the target machine actively refused it" suggests that the Loki service might not be running or is not accessible at the specified URL and port.

Here are a few steps you can take to troubleshoot and resolve the issue:

  1. Verify Loki is Running: Ensure that the Loki service is actually running on your machine. You can do this by checking the services or processes on your system to see if Loki is active.

  2. Check Loki Configuration: Make sure that Loki is configured to listen on the correct port (3100) and that it is bound to the correct network interface (e.g., localhost or 0.0.0.0).

  3. Firewall and Network Settings: Check if there are any firewall rules or network settings that might be blocking access to port 3100 on your machine.

  4. Correct URL: Double-check the URL in Grafana's data source configuration. It should match the address and port where Loki is running. If Loki is running on a different machine, ensure you use the correct IP address or hostname.

  5. Logs for More Details: Look at the Loki logs for any errors or warnings that might indicate why it is not accepting connections.

  6. Test Connection with Curl: From the command line, try using curl to access the Loki endpoint directly to see if you can connect: bash curl http://localhost:3100/loki/api/v1/status/buildinfo This should return some JSON data if Loki is running and accessible.

  7. Basic Authentication: If you have set up basic authentication, ensure that the credentials are correct and that Loki is configured to accept them.

  8. Check for Port Conflicts: Ensure no other service is using port 3100 on your machine.

If after these steps you are still facing issues, please provide any additional error messages or logs from Loki, as they might give more insight into the problem.

xoxo Grot

grot is still learning and improving, please let me know how I did by reacting below.

👍🏽 or 👎🏽