Date: Sun, 28 Dec 2003 12:47:38 -0600 From: Marc Wiz <marc@wiz.com> To: FreeBSD Questions <freebsd-questions@freebsd.org> Subject: Re: Log Rotation Message-ID: <20031228184738.GA5235@wiz.com> In-Reply-To: <3FEF1FC2.6000701@mindcore.net> References: <200312280948.15063.fbsd-questions@trini0.org> <44n09cj142.fsf@be-well.ilk.org> <200312281303.14444.fbsd-questions@trini0.org> <3FEF1FC2.6000701@mindcore.net>
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 -- Marc Wiz marc@wiz.com Yes, that really is my last name.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20031228184738.GA5235>