This is not quite a databasing script but a Syslog parser that might help you write what you need. Hope this helps you.
if `test -f $1`
then
ls //$1* > file.out
# Above is needed if there are mutliple syslog files and you want to report on them all
# this will make a listing of the files in a file called file.out and go through them all
for m in `cat $HOME/file.out` ; do `cat "$m" | egrep "^$2" | grep % | cut -d " " -f 1-20 >>$HOME/report.out` ; done
echo There have been `cat $HOME/report.out | cut -d" " -f3,4,8 | wc -l` syslog messages on $2
# Gets the syslog Messages and outputs them to "log.out"
cat $HOME/report.out | cut -d"%" -f 2 | cut -d " " -f 1 | sort -u > log.out
# Gets the number of each syslog Message and outputs them to "numbers.out"
for i in `cat $HOME/report.out | cut -d "%" -f 2 | cut -d " " -f 1 | sort -u` ; do echo `grep $i $HOME/report.out |wc -l`;done > numbers.out
#Get the number of routers for each syslog message and output them to "routers.out"
for a in `cat log.out` ; do echo `cat $HOME/report.out |grep $a | cut -d " " -f 4 | sort -u |wc -l`; done > routers.out
echo These are the different syslog messages that were reported
echo "Message ID Number of Messages Number of Routers Reporting this"
paste -d '\t \t ' log.out numbers.out routers.out
#rm *.out
else
echo "$1 is not a file"
fi
Regards,
Don