# # AWK to parse spamd logs (assuming syslogd adds 5 columns to each line). # Feel free to copy, alter and redistribute. # # $Id: spamd_summary.awk,v 1.2 2003/04/03 08:25:05 tjd Exp $ # BEGIN { FS="[ /()]+"; } /identified spam/ { score += $8; time += $13; size += $15; count ++; spamscore += $8; spamtime += $13; spamsize += $15; spamcount ++; } /clean message/ { score += $8; time += $13; size += $15; count ++; hamscore += $8; hamtime += $13; hamsize += $15; hamcount ++; } END { print "SpamAssassin report spam non-spam total"; print "-------------------------------------------------------------------"; printf "Number of messages scanned: %12i %12i %12i\n", spamcount, hamcount, count; if (count == 0) {count = 1;} if (hamcount == 0) {hamcount = 1;} if (spamcount == 0) {spamcount = 1;} printf "Average message score: %12.2f %12.2f %12.2f\n", spamscore/spamcount, hamscore/hamcount, score/count; printf "Average message size (kB): %12.2f %12.2f %12.2f\n", (spamsize/spamcount)/1024, (hamsize/hamcount)/1024, (size/count)/1024; printf "Average time to scan (secs): %12.2f %12.2f %12.2f\n", spamtime/spamcount, hamtime/hamcount, time/count; }