thanks for the perl script... this is what I use... it probably could be cleaner, but it works for me ;)
#!/bin/sh
# mail su/sudo/ssh root alerts based off the syslog-ng filter
while read line; do
msg=`echo $line|sed 's/^<[0-9][0-9]>//;'`
prog=`echo $msg|awk '{print $5}'|sed -r 's/((:$)|(\[[0-9].+\]:$)|(\([a-z_].+\[[0-9].+\]:$))//g'`
echo $msg|/bin/egrep '(@)' > /dev/null 2>&1
if [ $? -ne 0 ]; then
hostx=`echo $msg|awk -F"/" '{print $1}'|awk '{print $4}'`
else
hostx=`echo $msg|awk -F"@" '{print $2}'|awk '{print $1}'`
fi
echo $msg | /bin/mail -s "Log Alert - $hostx ($prog)" mailgroup@domain.com
done
UNIX Admin <infosec@gmail.com>
Sent by: syslog-ng-admin@lists.balabit.hu 04/07/2005 06:50 PM
|
|