I am using Grafana on docker. I can connect to the main UI. However I have some problems to establish a connection to a backend and that's why I would like to look at the logs.
According to the Docker file, they should be located at /var/log/grafana/ . However this directory is empty. What am I missing ?
Thanks !
The docker logs command shows information logged by a running container. The docker service logs command shows information logged by all containers participating in a service. The information that is logged and the format of the log depends almost entirely on the container's endpoint command.
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.
By default, Docker stores log files in a dedicated directory on the host using the json-file log driver. The log file directory is /var/lib/docker/containers/<container_id> on the host where the container is running.
I know this question has been dead for 15 months by now, but since it is the first result coming up when searching for grafana docker logs:
Grafana's logging mode in its default configuration is set to console
. You can change that by setting the environment variable GF_LOG_MODE
to console file
if you want the logs to be written to both, the console and a file. Set it to file
otherwise.
This works for docker-compose.yml
, docker run
or can be set at a later point of time from within the grafana-container by editing its grafana.ini
Edit: You might have to set the environment variable GF_LOG_LEVEL
in addition to GF_LOG_MODE
as your container might crash otherwise: GF_LOG_LEVEL=info
The different log-modes to chose from can be found in Grafana's precise documentation
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With