DESCRIPTION
RuleTimingRedis is a plugin for spamassassin which gathers and stores performance data of processed spamassassin rules in a redis server.
CONFIGURATION
To load the plugin put an loadplugin line into init.pre:
loadplugin Mail::SpamAssassin::Plugin::RuleTimingRedis
If the RuleTimingRedis.pm is not in perls @INC you need to specify the path:
loadplugin Mail::SpamAssassin::Plugin::RuleTimingRedis <path-to>/RuleTimingRedis.pm
If your redis server is not listening on 127.0.0.1:6379 configure the address in local.cf:
timing_redis_server 192.168.0.10:6379
Then restart amavisd.
After the first mail was processed the keys for the processed rules should appear in redis:
$ redis-cli
redis 127.0.0.1:6379> KEYS 'sa-timing.*'
1) "sa-timing.__DRUGS_SLEEP3.count"
2) "sa-timing.__MAIL_LINK.count"
3) "sa-timing.__CGATE_RCVD.count"
...
PARAMETERS
The plugin has the following configuration options:
- timing_redis_server (default: '127.0.0.1:6379')
-
Address and port of the redis server.
- timing_redis_password (default: no password)
-
Set if you redis server requires a password.
- timing_redis_exclude_re (default: '^__')
-
Regex to exclude rules from timing statistics.
The current SpamAssassin ruleset is about ~2k rules. The default will exclude all sub-rules that start with '__' (two underscores).
Set to empty string if you really want to measure all rules.
- timing_redis_prefix (default: 'sa-timing.')
-
Prefix to used for the keys in redis.
- timing_redis_database (default: 0)
-
Will call SELECT to switch database after connect if set to a non-zero value.
Database 0 is the default in redis.
- timing_redis_precision (default: 1000000)
-
Since redis uses integers the floating point value is multiplied by this factor before storing in redis.
- timing_redis_bulk_update (default: 50)
-
Will queue redis updates up to the configured value and execute them in bulks via a server-side script.
Requires a redis server >= 2.6.0 and Redis perl module >= 1.954.
Set to 0 to disable bulk.
- timing_redis_debug (default: 0)
-
Turn on/off debug on the Redis connection.
- timing_redis_hits_enabled (default: 0)
-
If enabled for each test that matched an counter will be incremented in the redis database.
127.0.0.1:6379> keys *.hits 1) "sa-timing.MISSING_SUBJECT.hits" 2) "sa-timing.MISSING_MID.hits" 3) "sa-timing.NO_RELAYS.hits" 127.0.0.1:6379> GET "sa-timing.MISSING_SUBJECT.hits" "3"