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\”: 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.

Welcome @randy2025

Which instructions would that be?

Grafana for Beginners.

Please provide link

Adding data sources to Grafana (Loki, Tempo, & Mimir) | Grafana for Beginners Ep. 6

I also found instructions here:
Grafana fundamentals | Grafana Labs

Followed them, result is the same.
Save & Test gets “Unable to connect with Loki.” When I do that test, I see this in the Grafana-server window:

INFO [12-06|14:09:44] Prepared request to Loki logger=tsdb.loki endpoint=CheckHealth endpoint=CheckHealth endpoint=CheckHealth endpoint=CheckHealth endpoint=checkHealth pluginId=loki dsName=loki dsUID=ce64m6g5doxdsb uname=admin fromAlert=false duration=0s queriesLength=1 stage=prepareRequest runInParallel=false
ERROR[12-06|14:09:44] Error received from Loki logger=tsdb.loki endpoint=CheckHealth endpoint=CheckHealth endpoint=CheckHealth endpoint=CheckHealth endpoint=checkHealth pluginId=loki dsName=loki dsUID=ce64m6g5doxdsb uname=admin fromAlert=false 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=2.4583ms 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
ERROR[12-06|14:09:44] Loki health check failed logger=tsdb.loki endpoint=CheckHealth endpoint=CheckHealth endpoint=CheckHealth endpoint=CheckHealth error=“error from loki: 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.”
INFO [12-06|14:09:44] Request Completed logger=context userId=1 orgId=1 uname=admin method=GET path=/api/datasources/uid/ce64m6g5doxdsb/health status=400 remote_addr=146.122.40.215 time_ms=5 duration=5.1202ms size=106 referer=http://pl2usm686v0:3000/connections/datasources/edit/ce64m6g5doxdsb handler=/api/datasources/uid/:uid/health status_source=server

where is your loki server installed at ? on same windows machine?

Yes. Everything is all on one machine.

How are you running Loki. How did you install it

I downloaded - grafana-enterprise-11.3.1.windows-amd64.zip
Unzipped it into a folder

Ran grafana.exe in a CMD window

Started browser
Went to http://localhost:3000
Logged in with admin/admin
Clicked on tile - Data Sources
Clicked Add new datasource
clicked on Loki
Entered loki data source for Name
Entered http://localhost:3100 for the URL
Clicked on Save & Test
Got error: “Unable to connect with Loki.”

I have been unable to get past this problem.

Yes, but the question was “How are you running Loki. How did you install it?”

Loki, not Grafana.

Antony.

1 Like

it seems that you have not installed Loki