Cant't find server log file in /var/log/grafana/

i can’t find my local server log file in default dir /var/log/grafana ,i use grafana8.5.3 on docker ,

Hi @thermallife,

Welcome to the :grafana: community forum !!

You can find the grafana logs using the command;

docker logs container-name



is the name you name for e.g. grafana or maybe used grafana8 etc.

Further information which I found via;

When running grafana via docker image the logs by defaults output to the 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

Additionally: 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 choose from can be found in Grafana’s precise documentation


Thank you in advance for all the support you are giving!!

I do have the exact same issue and I worked my way through the documentation. Below you can find my the grafana relevant docker compose code.

I would like to increase security and add grafana to my fail2ban list. For this I need the log files.

The log files just do not appear. Not in the defined volume, neither in the container itself at the specified location (I went an checked). I know that the GF_LOG_... does have an effect as I can silence the console output when I eliminiate console.

The console output (further down) also, in my eyes, confirms that everything seems in working order…

Can anyone help me out?
Thank you very much!

        image: grafana/grafana:latest ##right now 9.2.4
        container_name: grafana
        hostname: grafana
            - "influxdb"
            - default
            - t2_proxy
            - no-new-privileges:true
            - TZ=${TZ}
            - GF_LOG_MODE=file console
            - GF_LOG_LEVEL=info
            - GF_PATHS_LOGS=/var/log/grafana/
            - $APPDATADIR/grafana/data:/var/lib/grafana
            - $APPDATADIR/grafana/config/custom.ini:/etc/grafana/grafana.ini
            - $APPDATADIR/grafana/log:/var/log/grafana
            - $GRAFANA_PORT:3000
            - "traefik.enable=true"
            - "traefik.http.routers.grafana-rtr.entrypoints=https"
            - "traefik.http.routers.grafana-rtr.rule=Host(`grafana.$DOMAINNAME`)"
            - "traefik.http.routers.grafana-rtr.middlewares=chain-no-auth@file"
            - "traefik.http.routers.grafana-rtr.service=grafana-svc"
            - ""
        restart: unless-stopped

Console Output

13.11.2022 21:56:50
logger=settings t=2022-11-13T21:56:50.992200012+01:00 level=info msg="Config loaded from" file=/usr/share/grafana/conf/defaults.ini
13.11.2022 21:56:50
logger=settings t=2022-11-13T21:56:50.992209105+01:00 level=info msg="Config loaded from" file=/etc/grafana/grafana.ini
13.11.2022 21:56:50
logger=settings t=2022-11-13T21:56:50.992213016+01:00 level=info msg="Config overridden from command line" arg=""
13.11.2022 21:56:50
logger=settings t=2022-11-13T21:56:50.992217756+01:00 level=info msg="Config overridden from command line" arg="default.paths.logs=/var/log/grafana/"
13.11.2022 21:56:50
logger=settings t=2022-11-13T21:56:50.992220869+01:00 level=info msg="Config overridden from command line" arg="default.paths.plugins=/var/lib/grafana/plugins"
13.11.2022 21:56:50
logger=settings t=2022-11-13T21:56:50.992224219+01:00 level=info msg="Config overridden from command line" arg="default.paths.provisioning=/etc/grafana/provisioning"
13.11.2022 21:56:50
logger=settings t=2022-11-13T21:56:50.99222738+01:00 level=info msg="Config overridden from command line" arg="default.log.mode=console"
13.11.2022 21:56:50
logger=settings t=2022-11-13T21:56:50.992230719+01:00 level=info msg="Config overridden from Environment variable" var="GF_PATHS_DATA=/var/lib/grafana"
13.11.2022 21:56:50
logger=settings t=2022-11-13T21:56:50.992234611+01:00 level=info msg="Config overridden from Environment variable" var="GF_PATHS_LOGS=/var/log/grafana/"
13.11.2022 21:56:50
logger=settings t=2022-11-13T21:56:50.992237545+01:00 level=info msg="Config overridden from Environment variable" var="GF_PATHS_PLUGINS=/var/lib/grafana/plugins"
13.11.2022 21:56:50
logger=settings t=2022-11-13T21:56:50.992241805+01:00 level=info msg="Config overridden from Environment variable" var="GF_PATHS_PROVISIONING=/etc/grafana/provisioning"
13.11.2022 21:56:50
logger=settings t=2022-11-13T21:56:50.992244955+01:00 level=info msg="Config overridden from Environment variable" var="GF_LOG_MODE=file console"
13.11.2022 21:56:50
logger=settings t=2022-11-13T21:56:50.992249149+01:00 level=info msg="Config overridden from Environment variable" var="GF_LOG_LEVEL=info"
13.11.2022 21:56:50
logger=settings t=2022-11-13T21:56:50.992252353+01:00 level=info msg="Path Home" path=/usr/share/grafana
13.11.2022 21:56:50
logger=settings t=2022-11-13T21:56:50.992256692+01:00 level=info msg="Path Data" path=/var/lib/grafana
13.11.2022 21:56:50
logger=settings t=2022-11-13T21:56:50.992259675+01:00 level=info msg="Path Logs" path=/var/log/grafana/
13.11.2022 21:56:50
logger=settings t=2022-11-13T21:56:50.992264007+01:00 level=info msg="Path Plugins" path=/var/lib/grafana/plugins
13.11.2022 21:56:50
logger=settings t=2022-11-13T21:56:50.992267105+01:00 level=info msg="Path Provisioning" path=/etc/grafana/provisioning

Hi @akreaxun,

Sorry, I do not understand your question correctly. Because looking at your logs, it appears that the docker deployed the grafana container correctly.

What exactly do you want to add more? please explain