Log file no longer updating in /var/log/grafana

  • What Grafana version and what operating system are you using?
    v10.1.2 / Ubuntu 20.04.6 (using Docker)

  • What are you trying to achieve?
    Enable fail2ban to watch for failed login attempts

  • How are you trying to achieve it?
    I need fail2ban to monitor grafana logs in order to detect failed logins. I know there are logs in /var/lib/docker/containers/, however fail2ban cannot access this location.

  • What happened?
    Just realized that the grafana logs in /var/log/grafana/grafana.log has not been updated since ~July

  • What did you expect to happen?
    The logs to continue to be updated.

  • Did you receive any errors in the Grafana UI or in related logs? If so, please tell us exactly what they were.
    No errors in grafana logs via portainer.

Grafana in docker container logs to stdout (not to file).
So configure your Grafana in the container log into /var/log/grafana

Then use container volume to map host /var/log/grafana to container /var/log/grafana

I have setup the logs to point to /var/log/grafana and mapped the volume (tried several locations), but the log file never shows.

version: "3"
    external: true
    hostname: grafana
    container_name: grafana
    image: grafana/grafana:latest
    user: "1000"
     - proxy
     - 3000:3000
     - ./grafana:/config
     - ./logs:/var/log/grafana
     - GF_PATHS_DATA=/config/data
     - GF_PATHS_LOGS=/var/log/grafana
     - GF_LOG_MODE=console file
     - GF_PATHS_PLUGINS=/config/plugins
     - GF_INSTALL_PLUGINS=grafana-piechart-panel,grafana-worldmap-panel,natel-discrete-panel,grafana-clock-panel

So did you check Grafana logs for any errors?
Blind guess: you have problem with fs permissions so Grafana can’t write into log file.

Or you have some config which overwrites that log config.

It did turn out to be a permission issue since the Grafana container was set to run with user 1000. Was able to get the log file to write now, thank you for the assistance.