Filtering e-mail for spam and viruses can be done efficiently with Amavisd-New. Besides its own technologies to identify and filter out Spam it can also make use of Spamassassin and its results. However, since Amavisd starts Spamassassin itself, it sometimes is hard to debug when something is not working.
For example in a recent case I saw that the Bayes database was not used when checking for spam characteristics, although the database was properly trained with ham and spam.
Thus first I checked Spamassassin itself:
$ su -s /bin/bash mailuser -c "spamassassin -D -t < ExampleSpam.eml 2>&1" | tee sa.out
That worked well, the Bayes database was queried, results were shown.
Next, I added
$sa_debug = '1,all'; to the Amavisd configuration and run Amavisd in debug mode:
$ amavisd -c /etc/amavisd/amavisd.conf debug
And that showed the problem: one of the Bayes files had wrong permissions. After fixing those, the filter run again properly.