Differences between revisions 1 and 2
Revision 1 as of 2008-07-31 14:11:41
Size: 5577
Editor: dunxd
Comment:
Revision 2 as of 2010-08-13 17:06:30
Size: 5242
Editor: msapiro
Comment: Fixed a lot of formatting problems
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
#pragma page-filename DOC/versions/10715506 #pragma page-filename DOC/versions/10715508
Line 24: Line 24:
}}}


{{{
Line 36: Line 32:
}}}


{{{
Line 48: Line 40:
}}}


{{{
Line 60: Line 48:
}}}


{{{
Line 72: Line 56:
}}}


{{{
Line 84: Line 64:
}}}


{{{
Line 96: Line 72:
}}}


{{{
Line 108: Line 80:
}}}


{{{
Line 120: Line 88:
}}}


{{{
Line 132: Line 96:
}}}


{{{
Line 150: Line 110:
{{{
Line 151: Line 112:
{
{{{
{
Line 164: Line 124:
if \[ -f /home/mailman/data/master-qrunner.pid \]; then \ if [ -f /home/mailman/data/master-qrunner.pid ]; then \
Line 167: Line 127:
\\ }
Line 169: Line 129:

}
Line 180: Line 138:
\''''''''''''''''''''''''''''''''''''''''''''''''''''''''''__''''''''''''''''''''''''''''''''''''''''''''''''''''''''''\_ ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''_''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Line 189: Line 147:
\-------------------------
Line 192: Line 149:
\-------------------------
\\
Line 199: Line 154:
\-------------------------
}}}


{{{
\
++\+ Logging/Logger.py 2007-04-06 21:11:18.600639072 -0400
+++ Logging/Logger.py 2007-04-06 21:11:18.600639072 -0400
Line 209: Line 159:
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()
         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()
Line 215: Line 165:


{{{
\-------------------------
}}}

Line 225: Line 168:
" 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. ;-)<<BR>> " 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. ;-)
Line 229: Line 173:

''Last changed on Sun Apr 15 02:02:50 2007 by'' Jim Popovitch
<<Color2(Converted from the Mailman FAQ Wizard, col=darkgreen)>>
This is one of many [[../Frequently Asked Questions|Frequently Asked Questions]].
<<Color2(Converted from the Mailman FAQ Wizard, col=darkgreen)>>This is one of many [[../Frequently Asked Questions|Frequently Asked Questions]].

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 "

" 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. (jimpop@yahoo.com) Converted from the Mailman FAQ Wizard

This is one of many Frequently Asked Questions.

MailmanWiki: DOC/4.07 How can I rotate my Mailman logs? (last edited 2015-03-04 05:04:29 by msapiro)