1819920 Members
2521 Online
109607 Solutions
New Discussion юеВ

logrotate problems

 
SOLVED
Go to solution
Mario Caisapanta
Occasional Advisor

logrotate problems

I have installed logrotate to rotate some system logs.
I was testing logrotate with mail.log. It worked because I got a log named mail.log.1 but the new log (mail.log) is 0kb and I have sent some mails.

Thx for your help...

regards

MARIO
3 REPLIES 3
harry d brown jr
Honored Contributor
Solution

Re: logrotate problems


How does your logrotate work?

Does it copy or move the file? If it moves (mv) it and your mail application has the log file open, then the mail application is still pointing to the OLD inode.

If it is using a (cp) and then a "cat /dev/null" to your logfile, then it's a "buffer" issue which will flush when there the buffer becomes "full".

live free or die
harry
Live Free or Die
Hazem Mahmoud_3
Respected Contributor

Re: logrotate problems

Check the permissions of mail.log. Here is ours:
-r--r--r-- 1 root root 50021 Apr 26 00:00 mail.log

Also, below is the code we use for our log rotation. It might give you some ideas:

#!/bin/sh

mv -f /var/adm/syslog/auth.log /var/adm/syslog/auth.log.1
mv -f /var/adm/syslog/mail.log /var/adm/syslog/mail.log.1
mv -f /var/adm/syslog/syslog.log /var/adm/syslog/syslog.log.1

kill -HUP `cat /var/run/syslog.pid`

rm -f /var/adm/syslog/auth.log.1.gz
gzip /var/adm/syslog/auth.log.1
rm -f /var/adm/syslog/mail.log.1.gz
gzip /var/adm/syslog/mail.log.1
rm -f /var/adm/syslog/syslog.log.1.gz
gzip /var/adm/syslog/syslog.log.1


-Hazem
Mario Caisapanta
Occasional Advisor

Re: logrotate problems

Ok...thx a log for your help