#!/bin/sh
# put this file in /etc/cron.daily to receive daily firewall logs

# if you are not using /var/log/syslog as your system log file,
# adjust the LOGFILE filename (for example /var/log/ulog/syslog).
# note that the logtail tool generates ${LOGFILE}.fiaif.offset
LOGFILE=/var/log/syslog

# there should be no need to change any of the stuff below

LOGTAIL=/usr/sbin/logtail
FIAIFSCAN=/usr/sbin/fiaif-scan

if [ ! -x $LOGTAIL ]; then
    echo "error: logtail binary ($LOGTAIL) was not found"
    exit 1
fi
if [ ! -x $FIAIFSCAN ]; then
    echo "error: fiaif-scan binary ($FIAIFSCAN) was not found"
    exit 1
fi
if [ ! -r $LOGFILE ]; then
    echo "warning: log file ($LOGFILE) is not a readable file"
    echo "you should adjust the LOGFILE variable in $0"
    exit 0
fi
$LOGTAIL -f $LOGFILE -o ${LOGFILE}.fiaif.offset | /usr/sbin/fiaif-scan -n
