Peter,

> > > I put $DO_SYSLOG = 1 and now I see a lot more logging including the
> > > subject editing stuff.  However, at the same time I added

> The difference in logging verbosity between a logfile and syslogd must be
> due to the way amavisd interacts with the system's syslog.  I happen to be
> using OpenBSD 3.8.  Everything is chrooted but I have compensated for that
> (syslogd -a /var/amavisd/dev/log).

When logging to syslog, log level of each log message is mapped
to a syslog priority according to RELEASE_NOTES:


- syslog priorities are now dynamically derived from the log level of each
  log message (the first argument of sub do_log). The priority as specified
  in the $SYSLOG_LEVEL configuration variable is ignored in 2.0 (no longer
  in 2.1), but the 'facility' is not ignored. This makes it possible
  to influence the log verbosity by syslog.conf settings. Here is an
  example of a useful syslogd.conf setting (some levels may be left out;
  assumes the $log_level is high enough, e.g. 2, to produce any low-priority
  log messages at all):

    mail.err      /var/log/messages
    mail.notice   /var/log/amavisd.log
    mail.info     /var/log/amavisd-info.log
    mail.debug    /var/log/amavisd-debug.log

  (On linux do not forget to prefix filenames in syslog.conf with
   a '-' to disable sync, which has much impact on syslog performance!)

  At the moment the mapping of message log levels to syslog priorities
  is hardwired:
    level <= -3: LOG_CRIT
    level <= -2: LOG_ERR
    level <= -1: LOG_WARNING
    level <=  0: LOG_NOTICE
    level <=  1: LOG_INFO  (in version 2.0)
    level <=  2: LOG_INFO  (since 2.1)
    else:        LOG_DEBUG

  Not to be confused with the $log_level configuration variable setting,
  which still works as before, suppressing generation of all log messages
  with log levels above $log_level.

  For efficiency reasons one should not specify unnecessarily high $log_level
  and then discard low syslog priority messages in the syslogd.


The 2.1.0 reinstated the use of syslog priority in $SYSLOG_LEVEL setting:

- now a loglevel-based automatic syslog priority assignment can no longer
  lower a message syslog priority below the syslog priority specified
  in the $SYSLOG_LEVEL, it can only increase it; the violation of the
  least-surprise principle pointed out by Andy Dills;


> > I didn't have any explicit line for syslog log level but I
> > explicitly set it at 'mail.info' with no change.
> 
> When logging at level 5, I have noticed it appears to make no
> difference on some systems, but on others it does. I don't doubt
> it depends on settings in /etc/syslog.conf.

If there are no detailed log entries in syslog, it was probably your 
syslog.conf that caused the debug-priority log messages to be discarded.
Changing lowest syslog priority from 'mail.debug' to 'mail.info'
or 'mail.notice' or even 'mail.warning' makes syslog believe
that even the debug messages are more important. The same effect
can be achieved by adjusting syslog.conf filtering.

All the above applies to versions 2.1.0 or later
(but not for example to amavisd-new-20030616).

All the syslog priority stuff does not affect logging to a file directly
(not recommended). All log messages go there according to $log_level setting.


From Gary:

> If you set DO_SYSLOG = 0; then amavisd-new will log to a file. I think
> the file would (should?) be just as detailed.

Right, no filtering based on syslog priority there.

> It is best to define the 
> file in amavisd.conf and also make sure your amavisd-new user can write
> to the file (chown it to your amavisd-new user/group). I'm not sure,
> but if the file does not exist, you may have to touch it first.

The file is created if it does not exist.

> BTW amavisd.conf-sample says:
> #$SYSLOG_LEVEL = 'user.info'; # (facility.priority, default 'mail.info')    
> but in amavisd:
> $SYSLOG_LEVEL = 'mail.debug';

In the (future) 2.4.0 amavisd.conf and amavisd.conf-sample:

$syslog_ident = 'amavis';     # Syslog ident string (defaults to 'amavis')
$syslog_facility = 'mail';    # Syslog facility as a string
         # e.g.: mail, daemon, user, local0, ... local7, ...
$syslog_priority = 'debug';   # Syslog base (minimal) priority as a string,
         # choose from: emerg, alert, crit, err, warning, notice, info, debug

amavisd.conf-default:

# $syslog_ident = 'amavis';
# $syslog_facility = 'mail';    # after-default, derived from $SYSLOG_LEVEL
# $syslog_priority = 'debug';   # after-default, derived from $SYSLOG_LEVEL
# $SYSLOG_LEVEL = 'mail.debug'; # obsolete variable

(future) 2.4.0 release notes:

- new config variable $syslog_ident makes it possible to configure syslog
  ident string, its value defaults to 'amavis'; suggested by Andrzej Kukula;

- instead of the old config variable $SYSLOG_LEVEL (default value 'mail.debug')
  there are now two config variables $syslog_facility and $syslog_priority,
  defaulting for compatibility to the before-the-dot and after-the-dot
  substrings of the variable $SYSLOG_LEVEL; The $SYSLOG_LEVEL variable
  still exists, and can still be used, but is considered obsolete;

- make variables $syslog_ident, $syslog_facility and $syslog_priority
  dynamic variables, members of policy banks. This makes it possible for each
  policy bank to use its own specific syslog settings, for example to log
  to a different file (by using a different syslog facility like 'LOCAL3'
  for mail originating from inside - policy 'MYNETS'), or to change syslog
  ident to 'outgoing-amavis' for certain policy bank, or to rise syslog
  priority for releases from a quarantine. Note that switching syslog_ident
  or syslog_facility is done only when necessary, and involves closing and
  reopening syslog connection, which involves some (quite small) cost for
  each change. Dynamically changing syslog_priority however is for free;

Mark



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
AMaViS-user mailing list
AMaViS-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amavis-user
AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3
AMaViS-HowTos:http://www.amavis.org/howto/

Reply via email to