Grafana in docker log configuration

I am trying to read some grafana logs. Based on this: https://grafana.com/docs/grafana/latest/installation/configuration/#log it says:

mode
Either "console", "file", "syslog". Default is "console" and "file". Use spaces to separate multiple modes, e.g. console file

I am using grafana in docker. When I exec into the container and do this:

bash-5.0# echo $GF_PATHS_LOGS
/var/log/grafana
bash-5.0# ls -l /var/log/grafana/
total 0
bash-5.0#

When I check the conf/defaults.ini I can see this:

[log]
# Either "console", "file", "syslog". Default is console and file
# Use space to separate multiple modes, e.g. "console file"
mode = console file

so I’d take file is enabled.

If I do docker logs -f <containerId> I can see all the logs

However, I cannot see any file logs. Is the documentation wrong or am I missing something?

Config file is overwritten by run.sh (entrypoint of the Grafana container) - config parameter cfg:default.log.mode="console" is used. So mode is only console in the container.

Hi jangaraj, thanks for the reply.

Do you know why is that? The only way I see around this is having a custom entrypoint, but that doesn’t sound like a very good idea.

My goal is to ship grafana’s logs

Storing logs in the container is not good idea. I would say that is container antipattern and you shouldn’t use it in the container world.

Standard container practice is to send logs to the console only and infrastructure admin will process them outside of the container. For example you can configure Docker logging driver, logspout, cloud logs streaming (e.g. CloudWatch logs to ES), …

Check your documentation of used tool, where you want to ship logs and search/google options how to ship Docker logs (not just file logs).

Perhaps that is a good idea. Is it possible to send syslog logs from grafana when running in a container?