Logging improvement for SA spam score results

Quanah Gibson-Mount quanah at zimbra.com
Wed Mar 30 20:23:14 CEST 2016


Currently, to get the results of SA spam tests, one has to turn up the 
Amavis log level to 2, which is quite chatty.  The following patch from one 
of our customers adds a new optional variable that allows one to turn on SA 
test results specifically if desired, to allow logging their results w/o 
the rest of the overhead of Amavis loglevel 2:

--- amavisd/sbin/amavisd	2014-12-15 22:29:12.000000000 +0100
+++ amavisd/sbin/amavisd.rsc	2016-03-30 18:41:43.934000000 +0200
@@ -294,7 +294,7 @@
       $child_timeout $smtpd_timeout
       $policy_bank_name $protocol @inet_acl
       $myhostname $myauthservid $snmp_contact $snmp_location
-      $myprogram_name $syslog_ident $syslog_facility
+      $myprogram_name $syslog_ident $syslog_facility $log_sascan
       $log_level $log_templ $log_recip_templ $enable_log_capture_dump
       $forward_method $notify_method $resend_method $report_format
       $release_method $requeue_method $release_format
@@ -754,6 +754,7 @@
   $syslog_facility = 'mail';

   $log_level = 0;
+  $log_sascan = 0;

   # should be less than (1023 - prefix), i.e. 980,
   # to avoid syslog truncating lines; see sub write_log
@@ -15796,9 +15796,11 @@
                        scalar(@recip_cluster), $per_recip_data_len,
                        join(', ', map($_->recip_addr_smtp, 
@recip_cluster)));
   }
-  if (ll(2) && defined($cluster_full_spam_status) && @recip_cluster) {
+  if ((ll(2) || $Amavis::Conf::log_sascan) &&
+       defined($cluster_full_spam_status) && @recip_cluster) {
     my $s = $cluster_full_spam_status; $s =~ s/\n[ \t]/ /g;
-    do_log(2, "spam-tag, %s -> %s, %s", $msginfo->sender_smtp,
+    do_log(($Amavis::Conf::log_sascan) ? 0 : 2,
+              "spam-tag, %s -> %s, %s", $msginfo->sender_smtp,
               join(',', map($_->recip_addr_smtp, @recip_cluster)), $s);
   }
   ($hdr_edits, \@recip_cluster, $done_all);

--

Quanah Gibson-Mount
Platform Architect
Zimbra, Inc.
--------------------
Zimbra ::  the leader in open source messaging and collaboration
A division of Synacor, Inc


More information about the amavis-users mailing list