Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Feb 1998 09:25:29 +1100 (EST)
From:      "Daniel O'Callaghan" <danny@panda.hilink.com.au>
To:        Joao Carlos Mendes Luis <jonny@coppe.ufrj.br>
Cc:        jonny@coppe.ufrj.br, freebsd-hackers@FreeBSD.ORG
Subject:   Re: logrotate, a proposal
Message-ID:  <Pine.BSF.3.91.980211083951.294I@panda.hilink.com.au>
In-Reply-To: <199802101701.PAA11416@gaia.coppe.ufrj.br>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 10 Feb 1998, Joao Carlos Mendes Luis wrote:

> #define quoting(Daniel O'Callaghan)
> // I wanted to do a bit more with logrotate than just rotate to .0, .1 etc.
> // I'd like it to accept a strftime(3) format for the extension, along the 
> // lines of e.g. 'date +%h'.  Would you like to look into adding this facility?
> 
> Just occurred to me:
> 
> What should happen if somebody specifies a date format that have a limit
> on count and a count bigger than this limit ?  For example, %h and a
> count of 20.

They shoot themselves in the foot, and should have specified %Y-%h.
 
> Worst, how would I know from the format how to "walk" through the old
> logs and select the older one to delete ?  I cannot believe in the file
> date for this.

In my bourne shell version, I say 'daily' 'weekly' 'monthly' and 
calculate the number of days to keep the logs, based on find(1) and mtime.
In a perl version, it walks the directory looking for similarly named 
files, and stat(2)s them, looking for files X seconds old, X being 
calculated from the number of seconds in a day, and the number of days to 
keep the files.

> Also, strftime needs a date as an argument.  Which date would I feed
> into logrotate ?

Date has a nifty '-v' feature which lets you specify 'now - 1 day' or 
such.  Check date(1) for details.
 
> You don't have this problem in the script for wtmp rotating because
> 1) it does not delete old files, just overwrites them
> 2) it's always called at the first day of the month, so "yesterday"
>    is the reference month.
> 
> Maybe it's better not add such a feature in logrotate, and leave only
> numeric extensions.  (This does not mean I've changed my mind about
> newsyslog and logrotate needing to be fully rewritten)

I think it should be possible to specify the number of days/weeks/months to 
keep files. 

Of course, since the .0, .1 rotation method is used so much, it logrotate 
should be able to handle that, too.

How does that sound?

Danny

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.91.980211083951.294I>