Skip site navigation (1)Skip section navigation (2)
Date:      12 May 2004 08:54:08 -0400
From:      Lowell Gilbert <freebsd-questions-local@be-well.ilk.org>
To:        Barbish3@adelphia.net
Cc:        "freebsd-questions@FreeBSD. ORG" <freebsd-questions@FreeBSD.ORG>
Subject:   Re: Force newsyslog to rotate from custon script
Message-ID:  <44isf1x0un.fsf@be-well.ilk.org>
In-Reply-To: <MIEPLLIBMLEEABPDBIEGKENCFNAA.Barbish3@adelphia.net>
References:  <MIEPLLIBMLEEABPDBIEGKENCFNAA.Barbish3@adelphia.net>

next in thread | previous in thread | raw e-mail | index | archive | help
"JJB" <Barbish3@adelphia.net> writes:

> Problem description: My ipfilter log is rotated using
> newsyslog.conf. The file is rotated on file size option. I have
> custom script that reads the log and builds email containing list of
> abusive source IP address. This custom script is included in the
> daily management report process. Problem is that on days that there
> is a lot of blocked traffic the log may rotate multiple times and my
> daily management report script only runs against the current active
> log.
> 
> Is their some way to keep the log defined in newsyslog.conf without
> any rotate option and add something to my custom script to tell
> newsyslog to rotate the log after the script has processed the
> current active log file?

I would recommend a slightly different approach.  Either of a couple
of different approaches, in fact...

One way to do this would be to use a separate config file for
newsyslog(8) rather than /etc/newsyslog.conf.  Then you run newsyslog
and use the -f option to have it use your special-purpose
configuration just for rotating this ipfilter log.

The other way would be to do the rotation directly, in your script
which processes the file.  It should only take three or four commands
in the script.  That would let you more or less eliminate any race
conditions that might leave data out of your logs.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44isf1x0un.fsf>