Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I see only two files maillog and maillog.1 in /var/log.

grepping for maillog in logrotate.d directory gives three files that have a mention of maillog.

syslog

/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron {
#/var/log/messages /var/log/secure /var/log/spooler /var/log/boot.log /var/log/cron {
        daily
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
        /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}

syslog-ng

/var/log/messages /var/log/secure /var/log/maillog /var/log/spooler /var/log/boot.log /var/log/cron /var/log/kern.log /var/log/kern {
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
        /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}

and maillog.

/var/log/maillog  {
    daily
    compress
#    rotate 365
    rotate 14 
    sharedscripts
    postrotate
        /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true
        /bin/kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
    endscript
}

I am new to logrotate so may be I am missing something obvious. What can be the issue? The setup was already done when I started managing the server so I don't also know as do why do I have 3 mentions for maillog in logrotate.

share|improve this question
    
Can you also post your default logrotate configuration /etc/logrotate.conf? –  panaroik Sep 20 '12 at 9:55
    
@panaroik Please find the defaults here sprunge.us/CQFF –  shadyabhi Sep 20 '12 at 10:21

1 Answer 1

  • The first one is created by default.
  • The second one is created when installing syslog-ng.
  • The previous sysadmin creates the third one manually (maybe).

Which syslog service are you running?

ps -ef | grep syslog

UPDATE

Since you're using syslog-ng, all of the postrotate scripts are wrong, change it to something like this:

postrotate
    /bin/kill -HUP `cat /opt/syslog-ng/var/run/syslog-ng.pid 2> /dev/null` 2> /dev/null || true
endscript

then run in debug mode (no changes will be made to the logs) to see what happens:

logrotate -d -f /etc/logrotate.d/syslog-ng
share|improve this answer
    
/opt/syslog-ng/sbin/syslog-ng --no-caps. So, why are logs only 1 day old wven though I have set rotate 14 in maillog. –  shadyabhi Sep 20 '12 at 9:48
    
ls -l /var/log/maillog.1? –  quanta Sep 20 '12 at 14:36
    
sprunge.us/IfDY. I even removed the duplicate logs and still the problem persists. –  shadyabhi Sep 21 '12 at 5:18
    
Which part did you remove? updated my answer. –  quanta Sep 21 '12 at 6:48

Your Answer

 
discard

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.