Renaming log files while archiving - newsyslog?

2007-02-12 Thread Ewald Jenisch

Hi,

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 basename.YY-MM-DD-HH-MM-SS 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?

If not - is there another program that can archive/rename logfiles in
such a way?

Thanks much in advance for your help,
-ewald


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Renaming log files while archiving - newsyslog?

2007-02-12 Thread Lowell Gilbert
Ewald Jenisch [EMAIL PROTECTED] 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 basename.YY-MM-DD-HH-MM-SS 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.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]