So I've used this post as a reference:
I'm trying to set up traefik with docker-compose.
But, traefik doesn't output logfile.
My docker-compose.yml is here
My docker logs traefik file is getting very long. Per the post above the it would appear the defulat to to log to stdout, but it seems with docker the default log driver is json, and this file is kept within:
I'm really just trying to rotate the logs using logrotate to keep the traefik log as concise as possible. I've found a post on stack overflow discussing how to setup a setup with logrotate:
How to enable logrotation for traefik? - Stack Overflow
The only problem with these instructions is that my traefik logs are not within:
If a define an access log path similar to:
Will this capture the docker logs so I can appropriately rotate them or will the default logging location still be used (/var/lib/docker/containers/<container_id>/<container_id>-json.log)?
Just curious how best to implement this.
Docker natively supports rotating the log using the docker default log driver json-file.
You can set it per container or for the docker daemon as a whole.
Or you can choose a different log-driver altogether. You could, for example, us the syslog log-driver to send to your local syslog and then use regular log-rotate rules.
Alternatively you mount a directory and as per the referenced post use
--accesslog.filepath. Log rotation(logrotate) would need issue a
USR1 signal to complete rotation in an orderly fashion.
Hope this helps.
Thanks for the reference. I wasn't aware. Definitely pretty easy to configure json logging options with that link.
I am not using docker. How log rotation can be set for windows?
This question is specifically asked with a docker tag. Your is related but off-topic.