going to EFA web interface => Search and reports => SpamAssassin Rule Hits all I see are rules which hit SPAM, not a single rule seems to have hit any HAM?
Going back to Search & Reports I double checked that I do not have any active filters set. This EFA has been updated step by step from 3.0.1.5 to the current release.
Any ideas?
My SpamAssassin Rule Hits report is messed up
Re: My SpamAssassin Rule Hits report is messed up
Oh, me too. I guess I haven't run that report in a while.
Re: My SpamAssassin Rule Hits report is messed up
It's due to a couple of problems in rep_sa_rule_hits.php.
The logic is, look for the string "spam" or "not-spam" and count them up. However, there is no "not-spam" string in the spam report pulled from the spam report in the database.
There is a "not spam" string, but that string is thrown away in the beginning of processing, so the counts cannot be made.
The logic for the spam report string processing needs to be rethought.
/edit/
no, that's not quite right, but the problem is definitely in this file. still debugging.
The logic is, look for the string "spam" or "not-spam" and count them up. However, there is no "not-spam" string in the spam report pulled from the spam report in the database.
There is a "not spam" string, but that string is thrown away in the beginning of processing, so the counts cannot be made.
The logic for the spam report string processing needs to be rethought.
/edit/
no, that's not quite right, but the problem is definitely in this file. still debugging.
Last edited by pdwalker on 21 Jun 2017 06:13, edited 1 time in total.
Re: My SpamAssassin Rule Hits report is messed up
thanks for checking, must have broken a few updates ago.
I often run that report to check stats and find out which rules I need to tweak
I often run that report to check stats and find out which rules I need to tweak

Re: My SpamAssassin Rule Hits report is messed up
Ugh,
While the spam report handing is not perfect (autolearn=spam, required, autolearn=not showing up in the report when they should be stripped out), the fix is actually much simpler. Change:
to
Search for it and it'll be the first line you find.
While the spam report handing is not perfect (autolearn=spam, required, autolearn=not showing up in the report when they should be stripped out), the fix is actually much simpler. Change:
Code: Select all
if ($row->isspam !== 0) {
Code: Select all
if ($row->isspam != 0) {
Re: My SpamAssassin Rule Hits report is messed up
And just because those "funny" entries appear in the report have annoyed me enough, here is how to get rid of them:
Change
to
I've not tested it extensively and I might have missed a few cases, but it seems to work.
Change
Code: Select all
$junk = array_shift($sa_rules); // score=
$junk = array_shift($sa_rules); // required
Code: Select all
$junk = array_shift($sa_rules); // cached/not cached
$junk = array_shift($sa_rules); // score=
$junk = array_shift($sa_rules); // required
if( stripos($sa_rules[0],"autolearn=") !== false ) {
$junk = array_shift($sa_rules); // autolearn=spam or not spam, if present
}
Last edited by pdwalker on 21 Jun 2017 08:13, edited 1 time in total.
Re: My SpamAssassin Rule Hits report is messed up
You know what would be nice? Sortable table columns for the reports to make it easier to focus on what you are interested in.
Well, you can!
First, go here and read up on the documentation.
Then download the javascript library from here and save it to the mailscanner html directory (var/www/html/mailscanner/)
For this report, the only changes needed are:
from this:to this:
and this:
to this:
You may also wish to enable "stable sorting" by editing the sorttable.js script. See the topmost link for the documentation on "Stable sorting"
Changing the reports this way is a quick kludge. If you actually wanted to do it properly, the sorttable.js should be given a proper home and included in the templates for the reports.
Well, you can!
First, go here and read up on the documentation.
Then download the javascript library from here and save it to the mailscanner html directory (var/www/html/mailscanner/)
For this report, the only changes needed are:
from this:
Code: Select all
echo '<TABLE BORDER="0" CELLPADDING="10" CELLSPACING="0" WIDTH="100%">';
Code: Select all
echo '<script src="sorttable.js"></script>';
echo '<style> table.sortable th:not(.sorttable_sorted):not(.sorttable_sorted_reverse):not(.sorttable_nosort):after { content: " \25B4\25BE" }</style>';
echo '<TABLE BORDER="0" CELLPADDING="10" CELLSPACING="0" WIDTH="100%">';
Code: Select all
echo '<TABLE CLASS="boxtable" ALIGN="CENTER" BORDER="0">' . "\n";
Code: Select all
echo '<TABLE CLASS="boxtable sortable" ALIGN="CENTER" BORDER="0">' . "\n";
Changing the reports this way is a quick kludge. If you actually wanted to do it properly, the sorttable.js should be given a proper home and included in the templates for the reports.
- shawniverson
- Posts: 3783
- Joined: 13 Jan 2014 23:30
- Location: Indianapolis, Indiana USA
- Contact: