Mailgraph for Courier

From SpenchWiki

Jump to: navigation, search

This patch will allow mailgraph to work with logs produced by Courier and spamassassin (e.g. /var/log/mail.log).

Note: this patch should be applied to /usr/sbin/mailgraph and not /usr/lib/cgi-bin/mailgraph.cgi

--- /root/mailgraph.orig        2009-08-06 20:24:04.000000000 +1000
+++ /usr/sbin/mailgraph 2009-08-07 11:05:02.000000000 +1000
@@ -769,7 +770,36 @@
                elsif($text =~ /(?:result: )?CLAMAV/) {
                        event($time, 'virus');
                }
+# MY CHANGE: 'received' if NOT spam
+               elsif($text =~ /^(?:spamd: )?clean message/) {
+                       event($time, 'received');
+               }
+       }
+
+       elsif($prog eq 'courieresmtp') {
+               if ($text =~ /\bstatus: success$/) {
+                       event($time, 'sent');
+               }
+       }
+       elsif($prog eq 'courieresmtpd') {
+               if ($text =~ /\berror\b/) {
+                       if ($text =~ /\bDomain does not exist\b/ or $text =~ /\bRCPT TO\b/) {
+                               event($time, 'rejected');
+                       }
+               }
+       }
+       elsif($prog eq 'courierd') {
+               if ($text =~ /\bstatus: failure$/) {
+                       event($time, 'bounced');
+               }
        }
+# Only enable if not using spamd *ham* 'received' event above
+#      elsif($prog eq 'courierlocal') {
+#              if ($text =~ /\bsuccess: Message delivered\.$/) {
+#                      event($time, 'received');
+#              }
+#      }
        elsif($prog eq 'dspam') {
                if($text =~ /spam detected from/) {
                        event($time, 'spam');
Views
Personal tools
follow me
Latest Content
Blog
Gallery