Rotating Argus Logs

eric eric-list-argus at catastrophe.net
Tue Dec 27 22:54:49 EST 2005


On Tue, 2005-12-27 at 21:16:39 -0500, Scott Dexter proclaimed...

> Has anyone found a way to rotate argus logs on say a daily basis?
> (Perhaps even removing logs after a week or so).

Simple way is to do this...

#!/bin/sh

PATH="/usr/bin:/usr/sbin:/bin:/sbin"

COMPRESS="/usr/bin/gzip"
COMPRESSLEVEL="-5"
DATE="`date +%Y%m%d.%H%M`"

ARGUSARCHDIR="/var/argus"
ARGUSLOGFILE="/var/log/argus"

umask 007

if [ -f $ARGUSLOG ]; then
 mv $ARGUSLOG.cap $ARGUSARCHDIR/$ARGUSLOG-$DATE.cap
 $COMPRESS $COMPRESSLEVEL $ARGUSARCHDIR/$ARGUSLOG-$DATE.cap
else
 echo "$ARGUSLOG not found. exiting."
 exit 2
fi

Want to delete old files? find(1) is your friend.

find $ARGUSARCHDIR -name "argus-*" -ctime +7 -type f -exec rm \{\} \;



More information about the argus mailing list