Hi, I am trying to connect to mySql datablase, i am using grafana web version.
The datasource is not connecting and the message is “Query failed. Please inspect Grafana server log for details”. The docs explains “If you encounter an error or problem, then you can check the Grafana server log. Usually located at /var/log/grafana/grafana.log on Unix systems or in <grafana_install_dir>/data/log on other platforms and manual installations.” But where I can find the server log in the grafana web version?
The logs are only available at the backend server where the Grafana is installed for e.g. If your Grafana Server is using a Linux Virtual Machine or Docker or AWS etc, then all the server logs will be available on that server. The documentation is valid i.e. :
check the Grafana server log. Usually located at /var/log/grafana/grafana.log on Unix systems or in <grafana_install_dir>/data/log on other platforms and manual installations.”
I’m using the free Grafana cloud and also trying to view the logs. Specifically because I’m trying to setup a postgresql connection and getting the error “failed to connect to server - please inspect Grafana server log for details”
For Grafana Cloud server logs are only accessible to support staff.
To reconfigure a datasource and test its connection you can select it from the connect data page in your Grafana Cloud instance. From there you can test the integration connection. https://YOURORG.grafana.net/connections/connect-data/mysql
To check logs from the Grafana agent, you can find them at: var/log/grafana-agent.err.log
From these logs you can see the connections and telemetry attempts made by Grafana agent and any resulting errors.
Similar to the following:
caller=exporter.go:155 level=error integration=mysqld_exporter msg="Error pinging mysqld" err="Error 1045: Access denied for user 'root'@'172.17.0.1' (using password: YES)"
Once the integration has been established you can do 3 things.
Make queries to MySQL as a datasource.
Query your Grafana Cloud Prometheus instance for exported mysql metrics
Query your Grafana Cloud Loki instance for mysql’s server logs
Take a look at the logs in explore feature for more information on how to query and filter logs that have been ingested.
I am also interested in a solution here. I cannot connect to the database, with a message “query failed - please inspect Grafana server log for details”
If the logs are only accessible to support staff, what is the purpose of this message? Can you just tell me what the error is instead of telling me to look for the server log?
Have you white-listed all IPs that Grafana has listed on their site?
Working with Grafana Cloud Support, they actually realized they were missing two IP addresses that are required to be white-listed: 3.129.236.235 and 3.21.150.93
Once I added those to my white-list on my Google Cloud postgresql server instance, I was able to get the postgresql connection established within Grafana!
Grafana says they are working on getting those two IP addresses added to their docs site, I’m not sure what’s taking them so long.