Mail::SpamAssassin::Plugin::RuleTimingRedis - collect SA rule timings in redis
version 1.005
RuleTimingRedis is a plugin for spamassassin which gathers and stores performance data of processed spamassassin rules in a redis server.
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" ...
The plugin has the following configuration options:
Address and port of the redis server.
Set if you redis server requires a password.
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.
Prefix to used for the keys in redis.
Will call SELECT to switch database after connect if set to a non-zero value.
Database 0 is the default in redis.
Since redis uses integers the floating point value is multiplied by this factor before storing in redis.
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.
Turn on/off debug on the Redis connection.
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"
Markus Benning <ich@markusbenning.de>
This software is Copyright (c) 2015 by Markus Benning.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
To install Mail::SpamAssassin::Plugin::RuleTimingRedis, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mail::SpamAssassin::Plugin::RuleTimingRedis
CPAN shell
perl -MCPAN -e shell install Mail::SpamAssassin::Plugin::RuleTimingRedis
For more information on module installation, please visit the detailed CPAN module installation guide.