Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Grafana on docker: not able to find log

Tags:

docker

grafana

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 !

like image 960
poloC Avatar asked May 22 '18 13:05

poloC


People also ask

How can I see the logs inside a Docker container?

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.

Where are my grafana logs?

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.

Where are logs stored Docker?

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.


1 Answers

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

like image 85
Daniel Avatar answered Oct 06 '22 05:10

Daniel