#pragma page-filename DOC/versions/4030580 == 4.7. How can I rotate my Mailman logs? == Eric Toran's logrotate tool is recommended: {{{ http://rpmfind.net/linux/redhat/code/logrotate/ }}} !LogRotate is installed by default with most Linux distributions. Debian/Linux users are particularly well off in that the Debian Mailman package automatically installs a !LogRotate configuration wlong with Mailman. You may encounter problems using logrotate with MM 2.1.x because the qrunners run as daemons rather than cron jobs. They thus tend to hold open file descriptors to log files for their (indefinite) lifetime. You may need to wrap invocation of mailmanctl stopping and then starting the qrunners around the invocation of logrotate in order to get things to work right. Well thats what I found worked but if you have a better idea then update this FAQ page. Example configuration stanza for Mailman for !LogRotate (based on but not identical to the Debian defaults): {{{ /var/log/mailman/bounce { weekly missingok create 0664 list list rotate 4 compress delaycompress } /var/log/mailman/digest { monthly missingok create 0664 list list rotate 4 compress delaycompress } /var/log/mailman/error { weekly missingok create 0664 list list rotate 4 compress delaycompress } /var/log/mailman/post { monthly missingok create 0664 list list rotate 12 compress delaycompress } /var/log/mailman/smtp-failure { daily missingok create 0664 list list rotate 7 compress delaycompress } /var/log/mailman/smtp { daily missingok create 0664 list list rotate 7 compress delaycompress } /var/log/mailman/locks { daily missingok create 0664 list list rotate 7 compress delaycompress } /var/log/mailman/fromusenet { daily missingok create 0664 list list rotate 7 compress delaycompress } /var/log/mailman/qrunner { daily missingok create 0664 list list rotate 7 compress delaycompress } /var/log/mailman/subscribe { monthly missingok create 0664 list list rotate 12 compress delaycompress } /var/log/mailman/vette { weekly missingok create 0664 list list rotate 4 compress delaycompress } }}} Ok, Richard that's the long way. I use a shorter way File /etc/logrotate.d/mailman {{{ /home/mailman/logs/* { weekly missingok rotate 52 nomail compress delaycompress notifempty create 664 mailman mailman olddir /home/mailman/logs/old sharedscripts postrotate if [ -f /home/mailman/data/master-qrunner.pid ]; then \ /etc/init.d/mailman restart > /dev/null; fi endscript } }}} For the non-Linux folks, the included "newsyslog" in *BSD will do a similar job. Example /etc/newsyslog.conf entry: /usr/local/mailman/logs/bounce mailman:mailman 640 5 1000 * Z /usr/local/mailman/data/master-qrunner.pid ...and so forth for each log file. _____________________________________________________________ Hopefully this is an even better way: The diff below, against MM v2.1.9 changes logfile names to *.log, thus enabling your logroate script to not have to use olddir, nor do you have to have multiple logrotate stanzas, one per file. Use as follows: File /etc/logrotate.d/mailman: {{{ /home/mailman/logs/*.log { weekly missingok rotate 52 nomail compress delaycompress notifempty create 664 mailman mailman sharedscripts postrotate if [ -f /home/mailman/data/master-qrunner.pid ]; then \ /etc/init.d/mailman restart > /dev/null; fi endscript } }}} Mailman v2.1.9 diff: {{{ +++ Logging/Logger.py 2007-04-06 21:11:18.600639072 -0400 --- Logging/Logger.py.old 2007-04-06 21:10:05.672725800 -0400 @@ \-43,7 \+43,6 @@ Otherwise, the file is created only when there are writes pending. """ self.__filename = os.path.join(mm_cfg.LOG_DIR, category) + self.__filename += '.log' self.__fp = None self.__nofail = nofail self.__encoding = LOG_ENCODING or sys.getdefaultencoding() }}} NOTE: if you use mmdsr, you need to modify it to change ERR_LOGS and SUM_LOGS to update the new .log names. Additionally, you will need to change almost every line that contains "{LOG}" to correct the logfile name the if statements are trying to match. If you don't do this, then your mmdsr report will be much more verbose. Hth, -Jim P. <> And here's yet another logwatch script that works with standard Mailman (configured --with-var-prefix=/var/mailman) and accepts several logwatch defaults. {{{ /var/lib/mailman/logs/bounce \ /var/lib/mailman/logs/mischief \ /var/lib/mailman/logs/error \ /var/lib/mailman/logs/post \ /var/lib/mailman/logs/smtp \ /var/lib/mailman/logs/smtp-failure \ /var/lib/mailman/logs/qrunner \ /var/lib/mailman/logs/locks \ /var/lib/mailman/logs/fromusenet \ /var/lib/mailman/logs/subscribe \ /var/lib/mailman/logs/vette { missingok sharedscripts postrotate /usr/local/mailman/bin/mailmanctl reopen >/dev/null 2>&1 || true endscript } }}} Converted from the Mailman FAQ Wizard This is one of many [[../Frequently Asked Questions|Frequently Asked Questions]].