[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: logrotate



Quoting smb0399@osfmail.isc.rit.edu (smb0399@osfmail.isc.rit.edu):
> 
> I have quite a bit of trouble with logrotate and syslog. I am running
> logrotate and syslog pretty much exactly as they come from the potato
> release. With the exception that I added a logrotate file to logrotate.d
> to rotate my apache logs as well as turning on the compress option in
> logrotate.conf. The problem is that everytime it rotates my syslog files
> (weekly) it screws up syslog by making log to messages.0 etc... basically
> all my normal syslog files with a .0 extension. Anyone have this happen to
> them? 

Well, I hope it's not renaming syslog to messages.0, but
syslog -> syslog.0 and messages -> messages.0.

> I have temorarily added a restart to the rotate for syslog to restart
> syslog which solves the problem but it still creates the files.

When a unix program opens a file by its name, it is then unimportant
what happens to the filename - the program hangs onto the file's
inode. It's quite legitimate to even delete the filename - it won't
actually be removed until the program closes it. The name is merely
an entry in a directory.

So the restart is necessary to get the program to close the old file
which now has the "wrong" name and open a new one with the right name.
You get a whole day (week, month etc.) to do this because after the
next renaming (foobar.0 -> foobar.1) the file needs to be compressed,
which would not be possible if it was still open for writing.

Cheers,

-- 
Email:  d.wright@open.ac.uk   Tel: +44 1908 653 739  Fax: +44 1908 655 151
Snail:  David Wright, Earth Science Dept., Milton Keynes, England, MK7 6AA
Disclaimer:   These addresses are only for reaching me, and do not signify
official stationery. Views expressed here are either my own or plagiarised.


Reply to: