Robert,

> how to avoid that amavisd sends Passed Messages with mail.notice to syslog?
> $syslog_ident = 'amavis';
> $syslog_facility = 'mail';
> $syslog_priority = 'info';
> $log_level = 0;

The $syslog_priority can only increase the priority (e.g. in this case
the syslog priority would be 'info' even for less significant log
entries).

Log entries with log level 0 (like the main log entry $log_templ)
would still be submitted with LOG_NOTICE, according to mapping
of a log level to syslog priority in sub write_log:

    if    ($level >   2) { $prio = LOG_DEBUG   if $prio > LOG_DEBUG   }
    elsif ($level >=  1) { $prio = LOG_INFO    if $prio > LOG_INFO    }
    elsif ($level >=  0) { $prio = LOG_NOTICE  if $prio > LOG_NOTICE  }
    elsif ($level >= -1) { $prio = LOG_WARNING if $prio > LOG_WARNING }
    elsif ($level >= -2) { $prio = LOG_ERR     if $prio > LOG_ERR     }
    else                 { $prio = LOG_CRIT    if $prio > LOG_CRIT    }

You could modify a call to do_log when writing a main log entry
to use either log level 1 or 0, depending on whether there are
any blocked recipients. The following patch achieves this:

--- amavisd.orig        Fri May 25 19:26:56 2007
+++ amavisd     Mon May 28 20:01:06 2007
@@ -9344,7 +9344,11 @@
       my($y,$n,$f) = delivery_short_report($msginfo);
       @mybuiltins{'D','O','N'} = ($y,$n,$f);
-      my($strr) = expand(cr('log_templ'), \%mybuiltins);
-      for my $logline (split(/[ \t]*\n/, $$strr)) {
-        do_log(0, "%s", $logline)  if $logline ne '';
+      my($ll) = 0;  # log level for the main log entry
+      $ll = 1  if [EMAIL PROTECTED];  # tame down the log level if all passed
+      if (ll($ll)) {
+        my($strr) = expand(cr('log_templ'), \%mybuiltins);
+        for my $logline (split(/[ \t]*\n/, $$strr)) {
+          do_log($ll, "%s", $logline)  if $logline ne '';
+        }
       }
     }


The patch is against 2.5.1-rc1, but applies to 2.4.5 too
with some offset.

  Mark

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
AMaViS-user mailing list
[email protected]
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