Hi, 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? Can anybody help me? Thanks for all best regards michael
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
On Sat, 6 Dec 2003 11:16:12 +0100 michael <michael@nettmail.de> wrote:> 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?Maybe you need to think about your question again. Why is it that you wish the files to be named with a date? That is, what are you going to use it for? Remember, it is quite easy to make a little script that will find the date of a file from a 'ls -l' (or something like that) command. Will that help you? -- Yours, Torfinn Ingolfsen Norway
On Sat, 2003-12-06 at 04:16, michael wrote:> 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...Take a look at syslog-ng. I'm very happy with it. I configured mine to log to /var/log/$hostname/$date-messages, and it dumps one file per log (i.e. messages, auth) prefixed with the date into the directory (one directory per host). That's easily configured in syslog-ng.conf. For example: destination messages { file("/var/log/$HOST/$YEAR-$MONTH-$DAY-messages"); }; I highly recommend it over the plain old syslog. Regards, Frank -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 187 bytes Desc: This is a digitally signed message part Url : http://lists.freebsd.org/pipermail/freebsd-stable/attachments/20031206/c620728c/attachment.bin
Dear Michael! You know, that every file has additional data about time, when it was created etc. If you have good reason to read or ar- chive log files that way, put it on separate loca- tion and use cron to make that file. Change log file in /var/log every morning at ie. 7 am. Cron would read file named "my.log.0.gz" and rename it as "my.log.date.gz". date with"+" will make all for you (I suppose). Better to say, not cron, but little perl or shell script you write. After all put it on CD and forget. You could use cron to make your CD? I don't like the idea, but it's possible. Best regards ZK
On Sat, 6 Dec 2003, michael wrote:> Hi, > > 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.Note that this scheme has the potentially nasty side effect that if newsyslog did pruning by date, and somehow the system date got munged, it could erase all your old logfiles. In the current scheme that can't happen. And don't forget about ls -l for finding dates of things :-) -- Doug White | FreeBSD: The Power to Serve dwhite@gumbysoft.com | www.FreeBSD.org
At 11:16 AM +0100 12/6/03, michael wrote:>Hi, > >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?Right now there is no option in newsyslog which gives you that. There is a PR (problem-report) which has asked for this, and it is on the list of things I plan to do with newsyslog. Actually, I had planned to have that update done by now, but I had a few months of bad luck with some of my freebsd machines. (mostly hardware-related bad luck). -- Garance Alistair Drosehn = gad@gilead.netel.rpi.edu Senior Systems Programmer or gad@freebsd.org Rensselaer Polytechnic Institute or drosih@rpi.edu