On 1/22/24 14:50, Quanah Gibson-Mount wrote:
I noticed that our smtp.log and bounce.log files haven't been rotated in years. I see the reason for smtp.log not being rotated is due to <https://gitlab.com/mailman/mailman/-/issues/931>. Does this same issue affect bounce.log or is it safe to rotate similar to mailman.log?
Rotating all the logs in Mailman's var/logs/ directory is appropriate. This is the logrotate script I use.
/opt/mailman/mm/var/logs/*.log {
missingok
sharedscripts
su mailman mailman
postrotate
if [ -r /opt/mailman/mm/var/master.pid ]; then
PID=`cat /opt/mailman/mm/var/master.pid`
kill -s HUP $PID
fi
if [ -r /opt/mailman/mm/var/gunicorn.pid ]; then
PID=`cat /opt/mailman/mm/var/gunicorn.pid`
kill -s USR1 $PID
fi
endscript
}
You will still have the issue #931 in that the smtp.log will rotate, but as it says in that issue, the runners that write smtp.log directly will write to the new generation, but aiosmtpd continues to write to the older log until such time as mailman core is restarted. I'm not sure what will happen if mailman core is not restarted before the log aiosmtpd is writing to is rotated out of existence, but that could be an issue too.
You could avoid this by replacing
if [ -r /opt/mailman/mm/var/master.pid ]; then
PID=`cat /opt/mailman/mm/var/master.pid`
kill -s HUP $PID
fi
in the above postrotate script with
if [ -r /opt/mailman/mm/var/master.pid ]; then
sudo -u mailman /opt/mailman/mm/bin/mailman restart
&>/dev/null || true
fi
but there is a potential issue in that if Mailman is delivering list
mail when the mailman restart
command is issued, some recipients may
receive duplicates.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan