AIX and cron logs filtering ?: /etc/cronlog.conf, /var/adm/cron/log

Hi,
I can use 'crontabs �e' and do all the scheduling I like. However I would like to auto send myself just the cronjobs logs that fail. That is to say the PIDs that fail and the related lines with those PID�s only. (Not the full set of logs) Has anyone done this work? Or does an AIX 5.3 tool exists that will do this for me? If not I was thinking this could be a nice tool to use 'awk,' but I am not the best at 'awk.' I'm just a hack.

My current filter* only sends me logs when I have errors but it gives me the full set of data at that time, and I have to search for Fail. I copy my file to a tmp and clean up when done. Then I have my rotation set just rigt so I do not spam myself with dup data. PS I have read man for the cron/crontab commands + others and have not seen anything like this yet.
tia Keith

*
cronfile="/var/adm/cron/log"
tmp="/tmp/cron.tmp.log"
# COPY CRON FILE LOG TO TEMP TO SEND IN EMAIL LATER
cp -p $cronfile $tmp
#FILTER
if [[ $(cat $tmp | grep Fail | wc -l) > "1" ]] then
subject=$(print "Daily cron log $(date)" | tr ' ' '-')
uuencode $tmp $tmp | mail -s $subject $USER < $tmp
#end filter
fi
sleep 5;[[ -e $tmp ]] && rm $tmp

1 Like