Am 20.01.2016 um 20:03 schrieb Reindl Harald:
Am 20.01.2016 um 19:55 schrieb Antony Stone:On Wednesday 20 January 2016 at 19:50:23, Reindl Harald wrote:DELIVERED 32943 91.46 % BLOCKED 3679 10.21 %Why don't those add up to 100%? Or am I misunderstanding the labelling?grep/count of the maillog from the current month - mot every "sent" entry made it through the filter (local messages, milter-generated BCC's)..... the "blocked" is percentage of "spamd: result" lines
script attached as txt no, that's for sure not perfect but a fast way to get a good picture ________________ SPAMMY 3685 10.20 % 99.97 % (OF TOTAL BLOCKED)ther are for sure ham-messages which did get BAYES_60 but nothing else and went without issues (correctly) through the filter while there where for sure spam-messages with BAYES_80 and made it wrongly through the filter
the numbers at the end of the day are mostly correct, nearly zero spam makes it to the users and 3 complaints in the whole last year confirms it's fine
#!/usr/bin/bash MAILLOG="/var/log/maillog" TEMP_FILE=`mktemp -u` /usr/bin/sa-learn --dump magic | grep -v 'oldest atime' | grep -v 'newest atime' | grep -v 'last journal sync atime' | grep -v 'last expiry atime' | grep -v 'last expire atime delta' | grep -v 'last expire reduction count' | grep -v 'bayes db version' > $TEMP_FILE sed -i.bak 's/non-token data: //g' $TEMP_FILE sed -i.bak 's/ 0 nspam/ SPAM/g' $TEMP_FILE sed -i.bak 's/ 0 nham/ HAM/g' $TEMP_FILE sed -i.bak 's/ 0 ntokens/ TOKEN/g' $TEMP_FILE sed -i.bak 's/ 0//g' $TEMP_FILE sed -i.bak 's/0.000/0/g' $TEMP_FILE cat $TEMP_FILE rm $TEMP_FILE rm $TEMP_FILE.bak echo "" /usr/bin/ls -l -h --color=tty -X --group-directories-first --time-style=long-iso /var/lib/spamass-milter/.spamassassin/ echo "" BAYES_00=`grep 'spamd: result:.*BAYES_00,' $MAILLOG | wc -l` BAYES_05=`grep 'spamd: result:.*BAYES_05,' $MAILLOG | wc -l` BAYES_20=`grep 'spamd: result:.*BAYES_20,' $MAILLOG | wc -l` BAYES_40=`grep 'spamd: result:.*BAYES_40,' $MAILLOG | wc -l` BAYES_50=`grep 'spamd: result:.*BAYES_50,' $MAILLOG | wc -l` BAYES_60=`grep 'spamd: result:.*BAYES_60,' $MAILLOG | wc -l` BAYES_80=`grep 'spamd: result:.*BAYES_80,' $MAILLOG | wc -l` BAYES_95=`grep 'spamd: result:.*BAYES_95,' $MAILLOG | wc -l` BAYES_99=`grep 'spamd: result:.*BAYES_99,' $MAILLOG | wc -l` BAYES_999=`grep 'spamd: result:.*BAYES_999,' $MAILLOG | wc -l` BAYES_SPAMMY=`grep -P 'spamd: result:.*BAYES_(60|80|95|99),' $MAILLOG | wc -l` DNSWL=`grep -P 'spamd: result:.*(DNSWL|RCVD_IN_IADB_|RCVD_IN_RP_CERTIFIED|RCVD_IN_RP_SAFE|RCVD_IN_MSPIKE_WL)' $MAILLOG | wc -l` SPF=`grep -P 'spamd: result:.*(SPF_PASS|USER_IN_SPF_WHITELIST)' $MAILLOG | wc -l` SPF_WL=`grep -P 'spamd: result:.*(USER_IN_SPF_WHITELIST|USER_IN_DKIM_WHITELIST)' $MAILLOG | wc -l` SHORTCIRCUIT=`grep 'spamd: result:.*SHORTCIRCUIT' $MAILLOG | wc -l` DELIVERED=`grep 'relay=.*status=sent' $MAILLOG | grep -v 'to=<[email protected]>' | wc -l` BLOCKED=`grep -P 'Blocked by (SpamAssassin|Spamfilter)' $MAILLOG | wc -l` BAYES_TOTAL=`echo "$BAYES_00+$BAYES_05+$BAYES_20+$BAYES_40+$BAYES_50+$BAYES_60+$BAYES_80+$BAYES_95+$BAYES_99" | bc` SCANNED_TOTAL=`grep 'spamd: result:' $MAILLOG | wc -l` if [ "$BAYES_TOTAL" -gt 0 ]; then BAYES_00_PCT=`echo "scale=2; ($BAYES_00*100)/$BAYES_TOTAL" | bc | sed 's/^\./0./'` BAYES_05_PCT=`echo "scale=2; ($BAYES_05*100)/$BAYES_TOTAL" | bc | sed 's/^\./0./'` BAYES_20_PCT=`echo "scale=2; ($BAYES_20*100)/$BAYES_TOTAL" | bc | sed 's/^\./0./'` BAYES_40_PCT=`echo "scale=2; ($BAYES_40*100)/$BAYES_TOTAL" | bc | sed 's/^\./0./'` BAYES_50_PCT=`echo "scale=2; ($BAYES_50*100)/$BAYES_TOTAL" | bc | sed 's/^\./0./'` BAYES_60_PCT=`echo "scale=2; ($BAYES_60*100)/$BAYES_TOTAL" | bc | sed 's/^\./0./'` BAYES_80_PCT=`echo "scale=2; ($BAYES_80*100)/$BAYES_TOTAL" | bc | sed 's/^\./0./'` BAYES_95_PCT=`echo "scale=2; ($BAYES_95*100)/$BAYES_TOTAL" | bc | sed 's/^\./0./'` BAYES_99_PCT=`echo "scale=2; ($BAYES_99*100)/$BAYES_TOTAL" | bc | sed 's/^\./0./'` BAYES_999_PCT=`echo "scale=2; ($BAYES_999*100)/$BAYES_TOTAL" | bc | sed 's/^\./0./'` BAYES_SPAMMY_PCT=`echo "scale=2; ($BAYES_SPAMMY*100)/$SCANNED_TOTAL" | bc | sed 's/^\./0./'` BAYES_SPAMMY_BLOCKED_PCT=`echo "scale=2; ($BAYES_SPAMMY*100)/$BLOCKED" | bc | sed 's/^\./0./'` DNSWL_PCT=`echo "scale=2; ($DNSWL*100)/$SCANNED_TOTAL" | bc | sed 's/^\./0./'` SPF_PCT=`echo "scale=2; ($SPF*100)/$SCANNED_TOTAL" | bc | sed 's/^\./0./'` SPF_WL_PCT=`echo "scale=2; ($SPF_WL*100)/$SCANNED_TOTAL" | bc | sed 's/^\./0./'` DELIVERED_PCT=`echo "scale=2; ($DELIVERED*100)/$SCANNED_TOTAL" | bc | sed 's/^\./0./'` BLOCKED_PCT=`echo "scale=2; ($BLOCKED*100)/$SCANNED_TOTAL" | bc | sed 's/^\./0./'` SHORTCIRCUIT_PCT=`echo "scale=2; ($SHORTCIRCUIT*100)/$SCANNED_TOTAL" | bc | sed 's/^\./0./'` BAYES_60_BLOCKED_PCT=`echo "scale=2; ($BAYES_60*100)/$BLOCKED" | bc | sed 's/^\./0./'` BAYES_80_BLOCKED_PCT=`echo "scale=2; ($BAYES_80*100)/$BLOCKED" | bc | sed 's/^\./0./'` BAYES_95_BLOCKED_PCT=`echo "scale=2; ($BAYES_95*100)/$BLOCKED" | bc | sed 's/^\./0./'` BAYES_99_BLOCKED_PCT=`echo "scale=2; ($BAYES_99*100)/$BLOCKED" | bc | sed 's/^\./0./'` BAYES_999_BLOCKED_PCT=`echo "scale=2; ($BAYES_999*100)/$BLOCKED" | bc | sed 's/^\./0./'` echo -e "BAYES_00 `printf \"%*s\" 8 $BAYES_00` `printf \"%*s\" 7 $BAYES_00_PCT` %" echo -e "BAYES_05 `printf \"%*s\" 8 $BAYES_05` `printf \"%*s\" 7 $BAYES_05_PCT` %" echo -e "BAYES_20 `printf \"%*s\" 8 $BAYES_20` `printf \"%*s\" 7 $BAYES_20_PCT` %" echo -e "BAYES_40 `printf \"%*s\" 8 $BAYES_40` `printf \"%*s\" 7 $BAYES_40_PCT` %" echo -e "BAYES_50 `printf \"%*s\" 8 $BAYES_50` `printf \"%*s\" 7 $BAYES_50_PCT` %" echo -e "BAYES_60 `printf \"%*s\" 8 $BAYES_60` `printf \"%*s\" 7 $BAYES_60_PCT` % `printf \"%*s\" 8 $BAYES_60_BLOCKED_PCT` % (OF TOTAL BLOCKED)" echo -e "BAYES_80 `printf \"%*s\" 8 $BAYES_80` `printf \"%*s\" 7 $BAYES_80_PCT` % `printf \"%*s\" 8 $BAYES_80_BLOCKED_PCT` % (OF TOTAL BLOCKED)" echo -e "BAYES_95 `printf \"%*s\" 8 $BAYES_95` `printf \"%*s\" 7 $BAYES_95_PCT` % `printf \"%*s\" 8 $BAYES_95_BLOCKED_PCT` % (OF TOTAL BLOCKED)" echo -e "BAYES_99 `printf \"%*s\" 8 $BAYES_99` `printf \"%*s\" 7 $BAYES_99_PCT` % `printf \"%*s\" 8 $BAYES_99_BLOCKED_PCT` % (OF TOTAL BLOCKED)" echo -e "BAYES_999 `printf \"%*s\" 8 $BAYES_999` `printf \"%*s\" 7 $BAYES_999_PCT` % `printf \"%*s\" 8 $BAYES_999_BLOCKED_PCT` % (OF TOTAL BLOCKED)" echo "" echo -e "DELIVERED `printf \"%*s\" 8 $DELIVERED` `printf \"%*s\" 7 $DELIVERED_PCT` %" echo -e "DNSWL `printf \"%*s\" 8 $DNSWL` `printf \"%*s\" 7 $DNSWL_PCT` %" echo -e "SPF `printf \"%*s\" 8 $SPF` `printf \"%*s\" 7 $SPF_PCT` %" echo -e "SPF/DKIM WL `printf \"%*s\" 8 $SPF_WL` `printf \"%*s\" 7 $SPF_WL_PCT` %" echo -e "SHORTCIRCUIT `printf \"%*s\" 8 $SHORTCIRCUIT` `printf \"%*s\" 7 $SHORTCIRCUIT_PCT` %" echo "" echo -e "BLOCKED `printf \"%*s\" 8 $BLOCKED` `printf \"%*s\" 7 $BLOCKED_PCT` %" echo -e "SPAMMY `printf \"%*s\" 8 $BAYES_SPAMMY` `printf \"%*s\" 7 $BAYES_SPAMMY_PCT` % `printf \"%*s\" 8 $BAYES_SPAMMY_BLOCKED_PCT` % (OF TOTAL BLOCKED)" fi
signature.asc
Description: OpenPGP digital signature
