Hi Hope somebody can help me:) We specify the rotation of the logfile maillog as follows: /var/log/maillog { rotate 7 daily compress postrotate /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true endscript } For some reason the command doesn't succeed, i.e. the signal never reaches the syslog daemon. Consequently, syslogd will continue to write to a INODE that no longer has a file pointer effectively resulting is log data being lost. However, if the command is modified to: sleep 1; /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true the problem disappears. The easiest way to test this is to do the following commands when configurating the logfile /var/log/maillog as given above: #/usr/sbin/logrotate -f /etc/logrotate.conf #ls -l /var/log/maillog Note that the size is 0 #logger -p mail.info -t info TESTING #ls -l /var/log/maillog Note that the size is still 0 #/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` #logger -p mail.info -t info TESTING #ls -l /var/log/maillog Note that the size no longer is 0 Thanks /Mattias
On Fri, 31 Oct 2003 09:50:29 +0100 Olsson Mattias <mattias.olsson@siemens.com> wrote:
postrotate /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true endscript
I don't understand, why would you need to do that? logrotate does that automatically. I don't have that in any of my logrotote configs and my logs are rotating correctly. Charles -- I did this 'cause Linux gives me a woody. It doesn't generate revenue. (Dave '-ddt->` Taylor, announcing DOOM for Linux)
On 10/31/03 09:50:29, Olsson Mattias wrote:
We specify the rotation of the logfile maillog as follows:
/var/log/maillog { rotate 7 daily compress postrotate /bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true endscript }
The original SuSE's '/etc/logrotate.d/syslog' has: /var/log/mail { compress dateext maxage 365 rotate 99 missingok notifempty size +4096k create 640 root root sharedscripts postrotate /etc/init.d/syslog reload endscript } Notice the 'syslog reload': that's all you need. -- Cheers, Carlos Robinson
On Fri, 31 Oct 2003 13:21:54 +0100 "Carlos E. R." <robin1.listas@tiscali.es> wrote:
The original SuSE's '/etc/logrotate.d/syslog' has: ... postrotate /etc/init.d/syslog reload endscript
You are right. I missed out on that one. Charles -- "Calling EMACS an editor is like calling the Earth a hunk of dirt." -- Chris DiBona on Dirt (Open Sources, 1999 O'Reilly and Associates)
participants (3)
-
Carlos E. R.
-
Charles Philip Chan
-
Olsson Mattias