Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Dec 2003 12:47:38 -0600
From:      Marc Wiz <>
To:        FreeBSD Questions <>
Subject:   Re: Log Rotation
Message-ID:  <>
In-Reply-To: <>
References:  <> <> <> <>

Next in thread | Previous in thread | Raw E-Mail | Index | Archive | Help
On Sun, Dec 28, 2003 at 01:24:02PM -0500, Scott W wrote:
> The easy solution is to see if any of the log rotation scripts have the 
> 'right' behavior...if not, you can write your own script to do it, test 
> it by rotating the logs and then intentionally doing something to 
> produce log output (depending on your log level)...if you get the log 
> output, everything's happy.  What it should be doing is this (and a side 
> effect is you shouldn't run into log problems on other apps either):
> 1.  Copy the log file locally, using whatever naming convention you 
> want, eg logname.(massaged date/time stamp like $(date | cut -f' '))
> 2.  Truncate the existing log via cat /dev/null > original logfile . 
> This allows the logging progam to continue to log without an invalid fd..
> 3.  gzip or move the copied logfile to wherever, gzip it etc..

And it does help to check the documenation for the particular program
doing the logging to see if it has a way of switching the logs
via some external condition (e.g. a signal) or whether you can specify
when it should rotate the log.

Another possibility (although somewhat of a hack) is to stop the program,
rotate the log and then start the program up again.   Perhaps not for
a 24x7 environment but it does work.


Marc Wiz
Yes, that really is my last name.

Want to link to this message? Use this URL: <>