Re: Uptick in spam (bayes stats script)

2015-02-22 Thread Reindl Harald



Am 22.02.2015 um 15:30 schrieb @lbutlr:

On 21 Feb 2015, at 08:34 , LuKreme krem...@kreme.com wrote:

On Feb 18, 2015, at 6:20 AM, Reindl Harald h.rei...@thelounge.net wrote:


bayes-stats.txt


That is a lot cleaner and more obvious, thank you for sharing


I ran this just after log rotation and got div by zero errors, so here is a 
(nearly) completely pointless ‘fix’:

BAYES_TOTAL=`echo 
$BAYES_00+$BAYES_05+$BAYES_20+$BAYES_40+$BAYES_50+$BAYES_60+$BAYES_80+$BAYES_95+$BAYES_99
 | bc`

+ if [ ! $BAYES_TOTAL ]; then
   BAYES_00_PCT=`echo scale=2; ($BAYES_00*100)/$BAYES_TOTAL | bc | sed 
's/^\./0./‘`

…

   echo -e BAYES_999 `printf \%*s\ 8 $BAYES_999` `printf \%*s\ 7 
$BAYES_999_PCT` %”
+ fi

Yes, yes, I know, had I run the script a minute later, no error. But if I 
didn’t have OCD tendencies, would I even be on this list? :)


agreed - thanks - but the f don't work here, below a better one

- if [ ! $BAYES_TOTAL ]; then
+ if [ $BAYES_TOTAL -gt 0 ]; then



signature.asc
Description: OpenPGP digital signature


Re: Uptick in spam (bayes stats script)

2015-02-22 Thread @lbutlr
On 21 Feb 2015, at 08:34 , LuKreme krem...@kreme.com wrote:
 On Feb 18, 2015, at 6:20 AM, Reindl Harald h.rei...@thelounge.net wrote:
 
 bayes-stats.txt
 
 That is a lot cleaner and more obvious, thank you for sharing

I ran this just after log rotation and got div by zero errors, so here is a 
(nearly) completely pointless ‘fix’:

BAYES_TOTAL=`echo 
$BAYES_00+$BAYES_05+$BAYES_20+$BAYES_40+$BAYES_50+$BAYES_60+$BAYES_80+$BAYES_95+$BAYES_99
 | bc`

+ if [ ! $BAYES_TOTAL ]; then
  BAYES_00_PCT=`echo scale=2; ($BAYES_00*100)/$BAYES_TOTAL | bc | sed 
's/^\./0./‘`

…

  echo -e BAYES_999 `printf \%*s\ 8 $BAYES_999` `printf \%*s\ 7 
$BAYES_999_PCT` %”
+ fi

Yes, yes, I know, had I run the script a minute later, no error. But if I 
didn’t have OCD tendencies, would I even be on this list? :)

-- 
And she was drifting through the backyard
And she was taking off her dress
And she was moving very slowly
Rising up above the earth



Re: Uptick in spam (bayes stats script)

2015-02-21 Thread LuKreme
On Feb 18, 2015, at 6:20 AM, Reindl Harald h.rei...@thelounge.net wrote:
 
 bayes-stats.txt

That is a lot cleaner and more obvious, thank you for sharing


-- 
Once again I teeter at the precipice of the generation gap.



Re: Uptick in spam (bayes stats script)

2015-02-18 Thread Reindl Harald


Am 17.02.2015 um 15:23 schrieb Reindl Harald:

Am 17.02.2015 um 15:19 schrieb LuKreme:

On 16 Feb 2015, at 12:01 , Reindl Harald h.rei...@thelounge.net wrote:

given that 24266 messages had BAYES_00 with a total number of 30401
delivered mails in the current month that training strategy seems to
work well

[root@mail-gw:~]$ bayes-stats.sh


What is bayes-stats.sh?


as simple shell script


nicer version attached as plain-text file
using now bash + bc + printf for % and formatting

removed the su-calls by place it in a worker-dir and call that with su 
from a script in PATH, well output looks now like below


bayes-stats.sh
0.000  0  3  0  non-token data: bayes db version
0.000  0  10606  0  non-token data: nspam
0.000  0  10688  0  non-token data: nham
0.000  01387376  0  non-token data: ntokens
0.000  0  993467899  0  non-token data: oldest atime
0.000  0 1424264407  0  non-token data: newest atime
0.000  0 1424264867  0  non-token data: last journal 
sync atime

0.000  0  0  0  non-token data: last expiry atime
0.000  0  0  0  non-token data: last expire 
atime delta
0.000  0  0  0  non-token data: last expire 
reduction count


insgesamt 35M
-rw--- 1 sa-milt sa-milt 2,6M 2015-02-18 14:07 bayes_seen
-rw--- 1 sa-milt sa-milt  40M 2015-02-18 14:07 bayes_toks
-rw--- 1 sa-milt sa-milt   98 2015-02-17 11:37 user_prefs

BAYES_00 28000   75.84 %
BAYES_05   4371.18 %
BAYES_20   5461.47 %
BAYES_40   5971.61 %
BAYES_50  4503   12.19 %
BAYES_60   4371.18 %
BAYES_80   3220.87 %
BAYES_95   2240.60 %
BAYES_99  18505.01 %
BAYES_999 16474.46 %

Delivered:34896
SpamAssassin: 3071
#!/usr/bin/bash

MAILLOG=/var/log/maillog

/usr/bin/sa-learn --dump magic
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 -c 'spamd: result:.*BAYES_00,' $MAILLOG`
BAYES_05=`grep -c 'spamd: result:.*BAYES_05,' $MAILLOG`
BAYES_20=`grep -c 'spamd: result:.*BAYES_20,' $MAILLOG`
BAYES_40=`grep -c 'spamd: result:.*BAYES_40,' $MAILLOG`
BAYES_50=`grep -c 'spamd: result:.*BAYES_50,' $MAILLOG`
BAYES_60=`grep -c 'spamd: result:.*BAYES_60,' $MAILLOG`
BAYES_80=`grep -c 'spamd: result:.*BAYES_80,' $MAILLOG`
BAYES_95=`grep -c 'spamd: result:.*BAYES_95,' $MAILLOG`
BAYES_99=`grep -c 'spamd: result:.*BAYES_99,' $MAILLOG`
BAYES_999=`grep -c 'spamd: result:.*BAYES_999,' $MAILLOG`

BAYES_TOTAL=`echo 
$BAYES_00+$BAYES_05+$BAYES_20+$BAYES_40+$BAYES_50+$BAYES_60+$BAYES_80+$BAYES_95+$BAYES_99
 | bc`

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./'`

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` %
echo -e BAYES_80  `printf \%*s\ 8 $BAYES_80` `printf \%*s\ 7 
$BAYES_80_PCT` %
echo -e BAYES_95  `printf \%*s\ 8 $BAYES_95` `printf \%*s\ 7 
$BAYES_95_PCT` %
echo -e BAYES_99  `printf \%*s\ 8 $BAYES_99` `printf \%*s\ 7 
$BAYES_99_PCT` %
echo -e BAYES_999 `printf \%*s\ 8 $BAYES_999` `printf \%*s\ 7 
$BAYES_999_PCT` %
echo 

echo Delivered:`grep -c 'relay=.*status=sent' $MAILLOG`
echo SpamAssassin: `grep -c 'Blocked by SpamAssassin' $MAILLOG`


signature.asc
Description: OpenPGP digital signature