Spamassassin is not learning

directynewadmin

New member
Joined
Aug 7, 2014
Messages
7
Hi All!

I have Spamassassin working and checking emails. For user I have also set Threshold for 5. I have also set up teach folders according to this http://help.directadmin.com/item.php?id=358.

When I am testing my spam system I recieve 5 emails with SPAM rang from 1 to 7. Two over 5 are moved to SPAM folder - greate! Next 3 are in inbox folder. I am moving all of them to teach-isSpam folder and then run teach.sh script.

Script is working and put me output with "Learned tokens from 3 message(s) (22 message(s) examined)".

I did it 5 times, the same mail were addes to teach-isSpam folder. But Spamassassin doenst learn and still 3 emails arent spam.

In my opinion, should be.

What is wrong? Please help me.
 
Hello,

I have some time investigated in the learn function of Spamassassin and if you check here:

http://wiki.apache.org/spamassassin/BayesNotWorking

You can see there is a minimal limit for Spamassassin to kick in. You can check with the command:

Code:
spamassassin -D --lint

and check the output

Code:
debug: bayes: Not available for scanning, only 0 spam(s) in 
Bayes DB < 200

Also you can change this value maybe another DA can help you with the right config file.
 
Hi Again!

Ok, so I run
Code:
spamassassin -D --lint

and there is a lot of information.

A few modul error

Code:
sie  8 09:24:43.934 [26745] dbg: diag: [...] module not installed: Mail::SPF ('require' failed)
sie  8 09:24:43.934 [26745] dbg: diag: [...] module not installed: Geo::IP ('require' failed)
sie  8 09:24:43.934 [26745] dbg: diag: [...] module not installed: IO::Socket::IP ('require' failed)
sie  8 09:24:43.934 [26745] dbg: diag: [...] module not installed: Net::Patricia ('require' failed)

and regarding to word "Bayes" all the lines below
Code:
sie  8 09:24:43.964 [26745] dbg: plugin: loading Mail::SpamAssassin::Plugin::Bayes from @INC
sie  8 09:24:44.113 [26745] dbg: config: fixed relative path: /var/lib/spamassassin/3.004000/updates_spamassassin_org/23_bayes.cf
sie  8 09:24:44.113 [26745] dbg: config: using "/var/lib/spamassassin/3.004000/updates_spamassassin_org/23_bayes.cf" for included file
sie  8 09:24:44.113 [26745] dbg: config: read file /var/lib/spamassassin/3.004000/updates_spamassassin_org/23_bayes.cf
sie  8 09:24:44.703 [26745] dbg: plugin: Mail::SpamAssassin::Plugin::Bayes=HASH(0x3b63e20) implements 'learner_new', priority 0
sie  8 09:24:44.703 [26745] dbg: bayes: learner_new self=Mail::SpamAssassin::Plugin::Bayes=HASH(0x3b63e20), bayes_store_module=Mail::SpamAssassin::BayesStore::DBM
sie  8 09:24:44.712 [26745] dbg: bayes: learner_new: got store=Mail::SpamAssassin::BayesStore::DBM=HASH(0x4182188)
sie  8 09:24:44.712 [26745] dbg: plugin: Mail::SpamAssassin::Plugin::Bayes=HASH(0x3b63e20) implements 'learner_is_scan_available', priority 0
sie  8 09:24:44.712 [26745] dbg: bayes: tie-ing to DB file R/O /root/.spamassassin/bayes_toks
sie  8 09:24:44.713 [26745] dbg: bayes: tie-ing to DB file R/O /root/.spamassassin/bayes_seen
sie  8 09:24:44.713 [26745] dbg: bayes: found bayes db version 3

So next step was run
Code:
 sa-learn --dump magic

and then I see
Code:
0.000          0          3          0  non-token data: bayes db version
0.000          0         22          0  non-token data: nspam
0.000          0          0          0  non-token data: nham
0.000          0       1169          0  non-token data: ntokens
0.000          0 1407310985          0  non-token data: oldest atime
0.000          0 1407406965          0  non-token data: newest atime
0.000          0 1407407009          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

As a result, every time I am adding SPAM to lear-Is-SPAM folder and run teach it is adding new "nspam" but when I sening again THE SAME email to my mailbox they are not recognasie as spam.

Code:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on XXXXXXXX
X-Spam-Level: ***
X-Spam-Status: No, score=3.7 required=5.0 tests=FSL_HELO_BARE_IP_2,
	RCVD_HELO_IP_MISMATCH,RCVD_NUMERIC_HELO autolearn=no autolearn_force=no
	version=3.4.0

What is worng?
 
Sorry for next post, but I could not edit prev.

After all above, next ime and added 3 spam email to spam folder learn and I run my teach.sh script and the result is

Code:
learning spam via /home/admin/Maildir/.INBOX.teach-isspam...
Learned tokens from 3 message(s) (25 message(s) examined)

learning ham via /home/admin/Maildir/.INBOX.teach-isnotspam...
Learned tokens from 0 message(s) (0 message(s) examined)

syncing...
bayes: synced databases from journal in 0 seconds: 836 unique entries (836 total entries)

current status:
0.000          0          3          0  non-token data: bayes db version
0.000          0         25          0  non-token data: nspam
0.000          0          0          0  non-token data: nham
0.000          0       1183          0  non-token data: ntokens
0.000          0 1407310985          0  non-token data: oldest atime
0.000          0 1407482214          0  non-token data: newest atime
0.000          0 1407484240          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
 
See the lines:

Code:
non-token data: nspam

You got about 25 spam messages there is a minimal limit set normally 200 also for directadmin the last time I check.

This means you need minimal 200 spam messages before the learn function will work.
 
Hello All!

Many thanks for you help. You are absolutely right. Default Spamassassin need 200 spam and ham emails. More here: http://wiki.apache.org/spamassassin/BayesNotWorking.

In file /etc/mail/spamassassin/local.cf I have changed it to
Code:
bayes_min_ham_num  2
bayes_min_spam_num  20

Unfortunately it didn't work again. But before it I in this file added also "blacklist_from [email protected]" and then was sending from this email and it was delivered to mailbox normally - so also didn't work.

After change local.cf I kill all proces "spamd" and run spamd -d
 
I have tested it out and have set the config file and per user config file but Spamassins stays at the minimal limit of 200.

Maybe someone else knows a solution?
 
I am getting these errors:

Code:
[root@server ~]# sa-learn --ham --no-sync ham_directory
archive-iterator: no access to ham_directory: 2 at /usr/share/perl5/Mail/SpamAssassin/ArchiveIterator.pm line 830.
archive-iterator: unable to open ham_directory: 2
Learned tokens from 0 message(s) (0 message(s) examined)
[root@server ~]#
 
Last edited:
Please consider you might need to use sudo -u username to see actual data for the user under the question.

Thus if you run:


Code:
[B]root@server#[/B] sa-learn --dump magic

you see the situation actual for the root if you run it as root. And if you run:

Code:
[B]admin@server$[/B] sa-learn --dump magic

or


Code:
[B]root@server#[/B] sudo -u admin sa-learn --dump magic

you should see information from admin's bayes data.

At least that's what I've found myself when testing on my server.
 
I've that same problem but now when i use this.
Code:
[root@server ~]# sa-learn --dump magic
Use of uninitialized value in numeric ge (>=) at /usr/lib/perl5/site_perl/5.8.8/Mail/SpamAssassin/Plugin/AskDNS.pm line 214.

Already thanks.
 
Also I've this when i use:
Code:
/home/kevinfj7/.spamassassin/teach.sh

Code:
[root@server ~]# /home/kevinfj7/.spamassassin/teach.sh
learning spam via /home/kevinfj7/imap/kj-productions.nl/k.jaspers/Maildir/.INBOX.teach-isspam...
Use of uninitialized value in numeric ge (>=) at /usr/lib/perl5/site_perl/5.8.8/Mail/SpamAssassin/Plugin/AskDNS.pm line 214.
Learned tokens from 0 message(s) (0 message(s) examined)

learning ham via /home/kevinfj7/imap/kj-productions.nl/k.jaspers/Maildir/.INBOX.teach-isnotspam...
Use of uninitialized value in numeric ge (>=) at /usr/lib/perl5/site_perl/5.8.8/Mail/SpamAssassin/Plugin/AskDNS.pm line 214.
Learned tokens from 0 message(s) (0 message(s) examined)

syncing...
Use of uninitialized value in numeric ge (>=) at /usr/lib/perl5/site_perl/5.8.8/Mail/SpamAssassin/Plugin/AskDNS.pm line 214.

current status:
Use of uninitialized value in numeric ge (>=) at /usr/lib/perl5/site_perl/5.8.8/Mail/SpamAssassin/Plugin/AskDNS.pm line 214.
0.000          0          3          0  non-token data: bayes db version
0.000          0          0          0  non-token data: nspam
0.000          0          0          0  non-token data: nham
0.000          0          0          0  non-token data: ntokens
0.000          0          0          0  non-token data: oldest atime
0.000          0          0          0  non-token data: newest atime
0.000          0          0          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
 
I've seen someting
I've got this massage because of my other problem a long time ago
In form
Code:
http://forum.directadmin.com/showthread.php?t=48898&p=251081&highlight=#post251081
When i set this back it is gone.
But the old massage is showing up.
So i turned it back and set a # before rule 214 in the AskDNS.pm file.
Is this a problem??
I never discovered another fould.

Already thanks.
 
Back
Top