On Wed, May 3, 2023 at 2:38 AM Mark Sapiro <mark@msapiro.net> wrote:
Please don't hijack threads. Post a new topic as an original post, not as a reply to an old thread.
On 5/2/23 15:45, Christian via Mailman-users wrote:
I noticed that my mailman logfiles are not being rotated. I followed the instructions in
https://mail.python.org/archives/list/mailman-developers@python.org/message/
FM3TSMQ63JR2KROJGOSPENODOOQVRYCL/
Those instructions are for Mailman 2.1.
Now when I try and run logrotate I get the following error
root@zarathustra:/opt/mailman/mm/logs# logrotate /etc/logrotate.conf error: stat of /opt/mailman/mm/logs/bounce.log failed: No such file or directory error: stat of /opt/mailman/mm/error.log failed: No such file or directory error: stat of /opt/mailman/mm/mailman.log failed: No such file or directory error: stat of /opt/mailman/mm/mailmansuite.log failed: No such file or directory error: stat of /opt/mailman/mm/smtp.log failed: No such file or directory root@zarathustra:
What am I doing wrong please?
Here's a logrotate script I use:
/opt/mailman/mm/var/logs/*.log { missingok sharedscripts su mailman mailman postrotate sudo -u mailman /opt/mailman/mm/bin/mailman reopen &>/dev/null || true if [ -r /opt/mailman/mm/var/gunicorn.pid ]; then PID=`cat /opt/mailman/mm/var/gunicorn.pid` kill -s USR1 $PID fi endscript }
A couple of caveats. The first line of the postrotate script may be wrapped.
sudo ... true
is all one line.That line could also be
/opt/mailman/mm/bin/mailman --run-as-root reopen &>/dev/null || true
I.e., it either has to run as the mailman user or specify the --run-as-root option.
Also, if logs aren't in /opt/mailman/mm/var/logs/ or gunicorn.pid isn't in /opt/mailman/mm/var/ those paths need adjusting.
Finally, there may be an issue with
mailman reopen
in the postrotate scrupt. See https://gitlab.com/mailman/mailman/-/issues/1078
In my case, I took a different approach with Django's logging configuration: [snip] 'handlers': { 'file': { 'level': 'INFO', 'class': 'logging.handlers.TimedRotatingFileHandler', 'filename': '/opt/mailman/mm/var/logs/mailmanweb.log', 'when': 'D', # specifies the interval 'interval': 1, # defaults to 1, only necessary for other values 'backupCount': 5, # how many backup file to keep, 5 days 'formatter': 'simpleRe', }, }, [snip]
I have not been rotating the other log files as my list is not a high-volume one so logs aren't growing much. Plus I only rely on the logs for diagnostics, not for records ;(
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-) [How to ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html]