Overview
The Warden Bayes filter requires a minimum of 200 trained spam messages before it becomes active. While training typically occurs automatically through real-time learning, auto-learning, or the Plesk nightly script, administrators can initiate manual training to accelerate system initialization.
Manual Training from Message Directories
Use the /usr/bin/sa-learn utility to process existing message directories. Execute the appropriate command based on the intended classification:
- Train as Spam: Process a directory containing unwanted messages.
sa-learn --spam --username=amavis --use-ignores --local --progress /var/qmail/mailnames/example.com/johndoe/Maildir/.Spam/cur/
- Train as Ham: Process a directory containing legitimate messages.
sa-learn --ham --username=amavis --use-ignores --local --progress /var/qmail/mailnames/example.com/johndoe/Maildir/cur
Viewing Learning Statistics
Monitor the current state of the Bayes database via the command line or through the Warden dashboard (Anti-spam Learning Statistics widget).
sa-learn --dump magic
Migrating Bayes Data Between Servers
Administrators can export and import Bayes training data to synchronize filters across environments. Ensure Warden is fully installed on the destination server before proceeding.
- Export Data: On the source server, generate a backup of the Bayes database.
sa-learn -u amavis --backup > /tmp/amavis-bayes.db
- Transfer File: Securely copy the /tmp/amavis-bayes.db file to the destination server.
- Import Data: On the destination server, restore the database into Warden.
sa-learn -u amavis --restore /tmp/amavis-bayes.db
Common Issues & Notes
- Import Duration: Restoring large Bayes databases is resource-intensive. Importing a dump containing approximately 2 million tokens typically requires two hours or more.
- Activation Threshold: The filter will remain inactive until the required message/token thresholds are met. Use the statistics command above to verify progress before expecting classification changes.