Why is Loki's Docker Driver Client stopping to log after some time? Why is Loki's Docker Driver Client stopping to log after some time? docker docker

Why is Loki's Docker Driver Client stopping to log after some time?


I was experiencing the same issue.

My only differences in configuration are that I'm trialing the latest Enterprise Edition (19.03) as it brings dual logging capability although this is also supported in the latest CE versions, and I'm using the latest Loki Docker driver client now that the Github issue previously mentioned has been resolved.

I ended up setting the log-opts properties no-file and keep-file in docker-compose.yml:

logging:  driver: "loki"  options:    loki-url: "http://${LOKI_URL}:3100/loki/api/v1/push"    loki-batch-size: "400"    no-file: "false"    keep-file: "true"    max-size: "5m"    max-file: "3"

Since making this change I am receiving logs in Loki and can still use docker container logs and docker service logs on my Docker hosts.

no-file: "false" tells the driver to continue creating logs on disk and keep-file: "true" tells the driver to keep json logs if the container is stopped (by default files are removed).

Note: Originally I was adding these settings to /etc/docker/daemon.json on the host but would still see the error getting log reader issue, I had to switch to specifying the log driver per container/swarm service.


Regarding this issue

First I could see logs in Grafana and in command line with docker container logs, but after some time no more logs were shown.

On Grafana please select Query type: Range not Instant and you will see all the logs for the selected period of time, if exists in loki.