20090402

MTA log rotation for Messaging Server

Sun Java System Messaging Server do not rotate the log file of MTA process - mail.log. There is only a two steps of pseudo rotation between the files: mail.log_current, mail.log_yesterday and a mail.log "bucket".

Present activity is being logged into mail.log_current. It's content will be moved into mail.log_yesterday after a day period.
After the next day, it will end its rotation life inside the mail.log file, increasing its content.

To control the mail.log growth process I use the Solaris logadm tool.

book [/]# crontab -l
[...]
# Messaging Server MTA log rotation
0 0 * * 1 /usr/sbin/logadm -c -C 52 -t '$dirname/$basename.$n' /var/opt/sun/comms/messaging64/log/mail.log
book [/]#


Every monday, at 0:00 AM, the logadm rotates the given logfile. It copies the original file (-c) to a next available one, with increased version number ($basename.$n), and truncates the mail.log content to zero (-c). It keeps 52 copies of rotated files (-C 52) and cleans the rest.

No comments: