newsyslogwithdate-extension-logfiles

Matthew Seaman m.seaman at infracaninophile.co.uk
Sat Dec 6 03:37:52 PST 2003


On Sat, Dec 06, 2003 at 11:16:12AM +0100, michael wrote:

> i widely use FreeBSD and his enhancement's vs. other OS'es.
> 
> Now i have the wish that the 'newsyslog' uses date-extensions
> in the 'rotated' logfiles.
> eg:
> 
> messages.0.gz should be messages.20031206.gz and so on...
> 
> or any other extension that will give the date in the name of file?
> 
> is this possible with the newsyslog?
> I think no! And why?

Hmmm... newsyslog(8) has no intrinsic capability to label the backup
files it creates with the date.  It would be quite easy to write a
script that went round after newsyslog and renamed any backup log
files according to their last modification date, but that would mean
that newsyslog won't recognise the backup of the logfile when it comes
time to reclaim space in the partition.

You could insert the date into the file path by modifying /etc/crontab:

0 * * * * root d=/var/log/`date +%Y%m%d`; [ -d $d ] || mkdir $d ; newsyslog -a $d

but that still suffers from the problem of newsyslog(8) not being able
to remove the oldest backup files.

Also, take a look at the sysutils/cronolog port -- I don't think it
will help you very much with log files generated by syslogd(8) but it
works very well with apache and similar.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20031206/981e0fc3/attachment.bin


More information about the freebsd-stable mailing list