Grafana on docker: not able to find log
Asked Answered
T

2

8

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 !

Tracitracie answered 22/5, 2018 at 13:14 Comment(6)
check the docker logs, docker logs <container_id>. might be an issue with docker container.Goethe
Are you mounting a volume to /var/log/grafana? Or are you execing into the container and looking there? Note that (as mentioned in the docs) volumes are not automatically created any more. Have you upgraded from a pre-5.1 version?Amado
@RohanJMohite, thanks for your advice, it helped me to use docker logs to resolve my problem.Tracitracie
@SiHa, Thanks for your advice , howerer i can't mount the volume. Apparently, there is a problem between virtualBox and docker volumesTracitracie
i am also exec into the container and the grafana log folder is empty.Axil
Same here. latest 6.0 grafana docker image, either mounting /var/log/grafana folder or not has same effect, logs are produced only on consoleSynge
V
14

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

Veratrine answered 14/8, 2019 at 9:38 Comment(3)
Just clarify that you don't need to use quotes around "console file". Here's a section of my docker-compose.yml: - GF_LOG_MODE=console file - GF_LOG_LEVEL=debugBeggar
Thanks, I edited that slip of mine. Most likely autoformatted by my smartphone.Veratrine
"container might crash otherwise".... wasted hours literally due to this. Thank you very much!Potence
W
0

Grafana docker image log defaults output to console. So you can try docker logs container_name to find log

Wartburg answered 22/1, 2022 at 19:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.