From owner-freebsd-questions@FreeBSD.ORG Mon Feb 12 14:50:03 2007 Return-Path: X-Original-To: freebsd-questions@freebsd.org Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id ADEC816A401 for ; Mon, 12 Feb 2007 14:50:03 +0000 (UTC) (envelope-from freebsd-questions-local@be-well.ilk.org) Received: from mail4.sea5.speakeasy.net (mail4.sea5.speakeasy.net [69.17.117.6]) by mx1.freebsd.org (Postfix) with ESMTP id 8604A13C467 for ; Mon, 12 Feb 2007 14:50:03 +0000 (UTC) (envelope-from freebsd-questions-local@be-well.ilk.org) Received: (qmail 22356 invoked from network); 12 Feb 2007 14:50:02 -0000 Received: from dsl092-078-145.bos1.dsl.speakeasy.net (HELO be-well.ilk.org) ([66.92.78.145]) (envelope-sender ) by mail4.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 12 Feb 2007 14:50:02 -0000 Received: by be-well.ilk.org (Postfix, from userid 1147) id A5F0E2842D; Mon, 12 Feb 2007 09:50:01 -0500 (EST) To: Ewald Jenisch References: <20070212093218.GA4175@aurora.oekb.co.at> From: Lowell Gilbert Date: Mon, 12 Feb 2007 09:50:01 -0500 In-Reply-To: <20070212093218.GA4175@aurora.oekb.co.at> (Ewald Jenisch's message of "Mon\, 12 Feb 2007 10\:32\:18 +0100") Message-ID: <44wt2nig6e.fsf@be-well.ilk.org> User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.93 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: freebsd-questions@freebsd.org Subject: Re: Renaming log files while archiving - newsyslog? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Feb 2007 14:50:03 -0000 Ewald Jenisch writes: > I want to set up automatic archiving of logfiles and thought about > using the standard "newsyslog" for it. > > My problem though is that during archiving the logs should be renamed > to something like "." so the archived > files should contain the date/time when they have been archived. For > example an original file of "cisco.log" should give > "cisco.07-02-07-23-55-00.log". > > Does anybody out there know if "newsyslog" is capable of this? It isn't. > If not - is there another program that can archive/rename logfiles in > such a way? I'm sure there is, but I don't know any offhand. It's awfully easy to roll your own. You can even let newsyslog do the rotation and rename the files it puts out (using their mtime for your stamp). For example, I run the following on a monthly basis: cd ${HOME}/Mail filename=`date -v-1d '+sentmail.%Y-%m'` mv outgoing-mail archive/$filename It should probably check for an error on the cd command, but basically that's all you need. Be well.