Struggling with log rotation in Docker context
I'm running Mailman 3 via maxking's Docker implementation, and had an incident recently where something went badly wrong, and the file uwsgi-error.log filled up. As a consequence, so did the file system where that file resides,and things ground to a halt. The file is visible on the Docker host as /opt/mailman/web/logs/uwsgi-error.log.
I am unsure about how to rotate this file correctly. I could use logrotate on the host, but I can't locate any documentation that describes how to signal the relevant processes inside the mailman-web container. (Maybe this should be done within the container?)
I'd be grateful for any good advice on this.
Stephen
Hi Stephen,
I understand your fight.
In theory the following command should force Mailman Core container reopen its logs: docker-compose exec -T mailman-core mailman reopen
And I didn't find anything better than just restarting of Mailman Web container for the same purpose: docker-compose restart mailman-web
But both methods were not reliable in my setup for some reason, so I've ended with logs truncation instead:
cat <<EOF > /etc/logrotate.d/mailman /basedir/core/var/logs/*.log { size 10M copytruncate } /basedir/web/logs/*.log { size 10M copytruncate } EOF
Best regards, Danil Smirnov Mailman3.com
On Wed, Aug 26, 2020 at 3:09 PM <skenny@scss.tcd.ie> wrote:
I'm running Mailman 3 via maxking's Docker implementation, and had an incident recently where something went badly wrong, and the file uwsgi-error.log filled up. As a consequence, so did the file system where that file resides,and things ground to a halt. The file is visible on the Docker host as /opt/mailman/web/logs/uwsgi-error.log.
I am unsure about how to rotate this file correctly. I could use logrotate on the host, but I can't locate any documentation that describes how to signal the relevant processes inside the mailman-web container. (Maybe this should be done within the container?)
I'd be grateful for any good advice on this.
Stephen
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
Hi Danil,
Firstly, thank you so much for your reply, and I do apologize for taking so long to respond to your message.
I understand your approach, and it sounds reliable and sensible. I'm still a bit confused by something though. In your example, you create the file /etc/logrotate.d/mailman - I presume that it must live in, or be available in the container - but which one? You've created a single file, with entries for both the mailman-core and mailman-web logs. But the logs of -core are not available in -web and vice-versa. Did you mean to do separate "cat <<EOF > /etc/logrotate.d/mailman" operations for each container?
Thanks again Stephen
Hi Stephen,
My example assumes that there are folders (inside of /basedir) on a Docker host machine which are mounted to mailman containers. So we run logrotate on the host machine against those mapped folders. Hence, /etc/logrotate.d/mailman file is for the host machine as well.
Danil
On Fri, Sep 4, 2020 at 12:36 PM <skenny@scss.tcd.ie> wrote:
Hi Danil,
Firstly, thank you so much for your reply, and I do apologize for taking so long to respond to your message.
I understand your approach, and it sounds reliable and sensible. I'm still a bit confused by something though. In your example, you create the file /etc/logrotate.d/mailman - I presume that it must live in, or be available in the container - but which one? You've created a single file, with entries for both the mailman-core and mailman-web logs. But the logs of -core are not available in -web and vice-versa. Did you mean to do separate "cat <<EOF > /etc/logrotate.d/mailman" operations for each container?
Thanks again Stephen
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
OK, but inside say the mailman-web container, doesn't mailman still have a file descriptor open and pointing to the old (now rotated/renamed) log file? - I don't see how doing the rotation on the Docker host aloneis going to lead to mailman logging to a new log file.
Sorry if I'm being a bit dumb here. Any enlightenment welcome.
Stephen
For an answer, please refer to my earlier email in this thread: https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/message/...
On Fri, Sep 4, 2020 at 11:49 PM <skenny@scss.tcd.ie> wrote:
OK, but inside say the mailman-web container, doesn't mailman still have a file descriptor open and pointing to the old (now rotated/renamed) log file? - I don't see how doing the rotation on the Docker host aloneis going to lead to mailman logging to a new log file.
Sorry if I'm being a bit dumb here. Any enlightenment welcome.
Stephen
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
participants (2)
-
Danil Smirnov
-
skenny@scss.tcd.ie