From: Sven Hoexter Date: Mon, 17 Jan 2011 16:45:28 +0000 (+0100) Subject: Import stormbind script X-Git-Url: https://git.sven.stormbind.net/?a=commitdiff_plain;h=f6212ef7560173401ad51bafbbca45c73917a8d9;p=sven%2Fscripts.git Import stormbind script --- diff --git a/stormbind/gif-reject-stats.sh b/stormbind/gif-reject-stats.sh new file mode 100644 index 0000000..5de26b6 --- /dev/null +++ b/stormbind/gif-reject-stats.sh @@ -0,0 +1,34 @@ +#!/bin/sh +# stats about gif file rejects via postfix pcre body_checks +# sven@timegate.de + +MAILLOG="/var/log/mail.log" +RJL="/tmp/gifrejects.$$" + +grep "reject: body R0lGOD" $MAILLOG > $RJL + +printf "\n" +echo "Mail rejects with gif file statistics for host $(hostname)" +echo "==========================================================" +echo "Generated on $(date)" +printf "\n" +echo "Mail log starts on: $(head -n 1 $MAILLOG|awk '{print $1" "$2" "$3}')" +echo "First reject on: $(head -n 1 $RJL|awk '{print $1" "$2" "$3}')" +echo "Last reject on: $(tail -n 1 $RJL|awk '{print $1" "$2" "$3}')" +echo "Mail log ends on: $(tail -n 1 $MAILLOG|awk '{print $1" "$2" "$3}')" +echo "We have $(wc -l $RJL|awk '{print $1}') rejects in total in the logfile." +printf "\n" + +echo "Rejects sorted by number and sender address" +awk '{print $12}' $RJL|grep from|sed -e 's/from=//g'|sort|uniq -c|sort -rn +printf "\n" + +echo "Rejects sorted by number and destination address" +awk '{print $13}' $RJL|grep to|sed -e 's/to=//g'|sort|uniq -c|sort -nr +printf "\n" + +echo "Rejects sorted by number and sender-destination address combinations" +awk '{print $12" "$13}' $RJL|grep '^from'|sed -e 's/from=//g' -e 's/to=//g'|sort|uniq -c|sort -nr|awk '{print "\t"$1"\tFrom: "$2" To: "$3}' + +# CLEAN UP +rm $RJL \ No newline at end of file