From f6212ef7560173401ad51bafbbca45c73917a8d9 Mon Sep 17 00:00:00 2001 From: Sven Hoexter Date: Mon, 17 Jan 2011 17:45:28 +0100 Subject: [PATCH] Import stormbind script --- stormbind/gif-reject-stats.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 stormbind/gif-reject-stats.sh 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 -- 2.39.2