From owner-freebsd-questions@FreeBSD.ORG Sun Dec 28 10:47:40 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EA8B016A4CE for ; Sun, 28 Dec 2003 10:47:40 -0800 (PST) Received: from freshaire.wiz.com (freshaire.wiz.com [66.143.183.129]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8535643D49 for ; Sun, 28 Dec 2003 10:47:39 -0800 (PST) (envelope-from marc@wiz.com) Received: from freshaire.wiz.com (localhost [127.0.0.1]) by freshaire.wiz.com (8.12.9p2/8.12.6) with ESMTP id hBSIlcrT005273 for ; Sun, 28 Dec 2003 12:47:38 -0600 (CST) (envelope-from marc@freshaire.wiz.com) Received: (from marc@localhost) by freshaire.wiz.com (8.12.9p2/8.12.9/Submit) id hBSIlc67005272 for freebsd-questions@freebsd.org; Sun, 28 Dec 2003 12:47:38 -0600 (CST) Date: Sun, 28 Dec 2003 12:47:38 -0600 From: Marc Wiz To: FreeBSD Questions Message-ID: <20031228184738.GA5235@wiz.com> References: <200312280948.15063.fbsd-questions@trini0.org> <44n09cj142.fsf@be-well.ilk.org> <200312281303.14444.fbsd-questions@trini0.org> <3FEF1FC2.6000701@mindcore.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3FEF1FC2.6000701@mindcore.net> User-Agent: Mutt/1.4i Subject: Re: Log Rotation X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 28 Dec 2003 18:47:41 -0000 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.