Logging statistics

Mark Martinec Mark.Martinec+amavis at ijs.si
Wed Mar 30 15:07:32 CEST 2011


Patrick,

> most people I know run amavis with $log_level = 2, because it gives them
> valuable output on spam test scores. They feed this output to scripts and
> create statistics.

Is there any valuable information that is not available through macros
in a log template? I usually enable addition of tests, From and Subject
in a main log template.

With 2.7.0 there is a shorthand for enabling most of the extra information
in the mail log template:
  $log_templ = $log_verbose_templ;

The main reason for using a log level 2 is to obtain detailed timing reports
from both amavisd as well as SpamAssassin.

> However running amavis in that $log_level also creates a lot of unnecessary
> output - unless you debug.
> 
> I think it would be useful to have a separate option that lets amavis run
> with normal, low $log_level, but creates output for statistical purposes.

So, which information is missing?

> I am not sure though how it should be stored. Both, logfile and snmp.db,
> seem to be good places. I guess snmp.db would be the hard way. Anyway... 
> Would you consider adding such a feature?

The syslog priority provides additional flexibility. For example I keep three
logfiles for amavisd, one long-term/archival log at priority LOG_NOTICE,
which sees only log messages at priority 0 or more serious,
then one med-term log at LOG_INFO which corresponds to log level 2
or stronger, and a third one, a short term debug log file at LOG_DEBUG,
which sees all log messages from amavisd, plus a copy of mail.info
for convenience. Then you set $log_level to 2 or 5, and each file
receives its share of logging.

/etc/syslog.conf:

user.notice    /var/log/amavisd.log
user.info      /var/log/amavisd-info.log
user.debug,mail.info  /var/log/amavisd-debug.log


release_notes:

  The following table shows mapping of SpamAssassin log levels to amavisd
  log levels, and for completeness also shows mapping of amavisd log levels
  to syslog priorities (which has not changed since previous version):

    SA     amavisd  syslog
    -----  -------  -----------
             -3     LOG_CRIT
             -2     LOG_ERR
    error    -1     LOG_WARNING
    warn      0     LOG_NOTICE
    info      1     LOG_INFO
              2     LOG_INFO
    dbg       3     LOG_DEBUG
              4     LOG_DEBUG
              5     LOG_DEBUG

Mark


More information about the amavis-users mailing list