Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Mail Logs on Debian systems do not use the regular /etc/logrotate.d scripts to rotate them.

I want to force my mail logs to rotate daily (no matter how small), and compress the results, so that the numbering of the logfiles matches that of my other (busier) mail servers. Essentially, I want to end up with:

mail.log mail.log.0 mail.log.1.gz mail.log.2.gz ... mail.log.6.gz

Can someone tell me how to accomplish this?

share|improve this question
What mail system do you use? – Kazimieras Aliulis May 12 '09 at 15:39

1 Answer 1

up vote 7 down vote accepted

I'm presuming that at the moment you have the stock sysklogd installation and that your logfiles are rotated with the default /etc/cron.weekly/sysklogd script.

I would suggest that you edit /etc/cron.weekly/sysklogd script and modify:

logs=$(syslogd-listfiles --weekly)


logs=$(syslogd-listfiles --weekly -s mail\*)

This will prevent the default scripts from handling the mail logs.

Edit /etc/logrotate.d/sendmail and add entries for the appropriate files. You probably want something like:

/var/log/mail.log /var/log/ /var/log/mail.warn /var/log/mail.err {
        rotate 7
        create 640 root adm
           /etc/init.d/sysklogd reload

To check your configuration, run:

logrotate -d /etc/logrotate.conf

And verify that logrotate is doing what you want.

share|improve this answer
Perfect - exactly what I need - thank yoU! – Brent May 12 '09 at 16:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.