2 # stats about gif file rejects via postfix pcre body_checks
5 MAILLOG="/var/log/mail.log"
6 RJL="/tmp/gifrejects.$$"
8 grep "reject: body R0lGOD" $MAILLOG > $RJL
11 echo "Mail rejects with gif file statistics for host $(hostname)"
12 echo "=========================================================="
13 echo "Generated on $(date)"
15 echo "Mail log starts on: $(head -n 1 $MAILLOG|awk '{print $1" "$2" "$3}')"
16 echo "First reject on: $(head -n 1 $RJL|awk '{print $1" "$2" "$3}')"
17 echo "Last reject on: $(tail -n 1 $RJL|awk '{print $1" "$2" "$3}')"
18 echo "Mail log ends on: $(tail -n 1 $MAILLOG|awk '{print $1" "$2" "$3}')"
19 echo "We have $(wc -l $RJL|awk '{print $1}') rejects in total in the logfile."
22 echo "Rejects sorted by number and sender address"
23 awk '{print $12}' $RJL|grep from|sed -e 's/from=//g'|sort|uniq -c|sort -rn
26 echo "Rejects sorted by number and destination address"
27 awk '{print $13}' $RJL|grep to|sed -e 's/to=//g'|sort|uniq -c|sort -nr
30 echo "Rejects sorted by number and sender-destination address combinations"
31 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}'