]> git.ipfire.org Git - thirdparty/AWStats.git/commitdiff
maillogconvert support more exotic sendmail log files
authoreldy <>
Wed, 10 Sep 2003 12:25:31 +0000 (12:25 +0000)
committereldy <>
Wed, 10 Sep 2003 12:25:31 +0000 (12:25 +0000)
docs/awstats_changelog.txt
tools/maillogconvert.pl

index c8fca7d912d7de1a1f032866fa4ab977d418f4a6..dc764228bb2abb09f512e35e99c290bb75236dc9 100644 (file)
@@ -10,12 +10,14 @@ Fixes:
 - Fixed problem of parsing with uabracket and refererquot.
 - Fixed wrong use of config file in rawlog plugin.
 - Some changes on maillogconvert.pl:
+  maillogconvert support more exotic sendmail log files.
   Fixed pb of '-' in relay hostname.\r
-  When a mail is sent to 2 different receivers, report 2 records instead of 1.\r
+  When a mail is sent to 2 different receivers, now report 2 records.\r
   When a forward is active, report the original receiver, not the
   "forwarded to".
 - Fixed not working timezone plugin with 5.7.
 - Fixed missing propagated configdir parameter when changing month/year.
+- Error when loading database pm file with some cygwin perl version.
 
 New features/improvements:
 - Added %lognamequot tag for LogFormat parameter.\r
index dfd88da318b4999cff7722ccd25b70c951e365f4..58e799414f6864242b1be88ac5ec0b17db73659d 100644 (file)
@@ -259,6 +259,50 @@ while (<>) {
                        debug("For id=$id, found a sendmail error incoming message: code=$entry{$id}{'code'} from=$entry{$id}{'from'} to=$entry{$id}{'to'} relay_s=$entry{$id}{'relay_s'}");
                }
        }
+       #
+       # See if we received postfix email bounced error
+       #
+       elsif (/stat(us)?=bounced/ ne undef) {
+               # Example: 
+               # postfix:  Sep  9 18:24:23 halley postfix/local[22003]: 12C6413EC9: to=<etavidian@partenor.com>, relay=local, delay=0, status=bounced (unknown user: "etavidian")
+               my ($mon,$day,$time,$id,$to,$relay_r)=m/(\w+)\s+(\d+)\s+(\d+:\d+:\d+)\s+[\w\-]+\s+(?:postfix\/(?:local|smtpd|smtp))\[\d+\]:\s+(.*?):\s+to=([^\s,]*)[\s,]+relay=([^\s,]*)/;
+               $rowid=($id eq 'reject'?999:$id);       # id not provided in log, we take 999
+               if ($rowid) {
+                       $entry{$rowid}{'code'}="999";   # Unkown error (bounced)
+                       $entry{$rowid}{'to'}=&trim($to);
+                       $entry{$rowid}{'relay_r'}=&trim($relay_r);
+                       $entry{$rowid}{'mon'}=$mon;
+                       $entry{$rowid}{'day'}=$day;
+                       $entry{$rowid}{'time'}=$time;
+                       debug("For id=$rowid, found a postfix bounced incoming message: code=$entry{$rowid}{'code'} to=$entry{$rowid}{'to'} relay_r=$entry{$rowid}{'relay_r'}");
+               }
+       }
+
+       #
+       # See if we send a sendmail (with ctladdr tag) email
+       #
+       elsif(/, ctladdr=/ ne undef) {
+                       #
+                       # Matched outgoing sendmail/postfix message
+                       #
+                       my ($mon,$day,$time,$id,$to,$from)=m/(\w+)\s+(\d+)\s+(\d+:\d+:\d+)\s+\w+\s+(?:sm-mta|sendmail(?:-out|)|postfix\/(?:local|smtpd|smtp))\[.*?\]:\s+([^:]*):\s+to=(.*?)[,\s]+ctladdr=([^\,\s]*)/;
+                       $rowid=$id;
+                       if (m/\s+relay=([^\s,]*)[\s,]/) { $entry{$id}{'relay_r'}=$1; }
+                       elsif (m/\s+mailer=local/) { $entry{$id}{'relay_r'}='localhost'; }
+                       if (/, stat\=Sent/) { $entry{$id}{'code'}=1; }
+                       elsif (/, stat\=User\s+unknown/) { $entry{$id}{'code'}=550; }
+                       elsif (/, stat\=Local\s+configuration/) { $entry{$id}{'code'}=451; }
+                       elsif (/, stat\=Deferred:\s+(\d*)/) { $entry{$id}{'code'}=$1; }
+                       else { $entry{$id}{'code'}=999; }
+                       $entry{$id}{'mon'}=$mon;
+                       $entry{$id}{'day'}=$day;
+                       $entry{$id}{'time'}=$time;
+                       $entry{$id}{'to'}=&trim($to);
+                       $entry{$id}{'from'}=&trim($from);
+                       $entry{$id}{'size'}='?';
+                       debug("For id=$id, found a sendmail outgoing message: to=$entry{$id}{'to'} from=$entry{$id}{'from'} size=$entry{$id}{'size'} relay_s=$entry{$id}{'relay_s'}");
+       }
+
        #
        # See if we received sendmail, postfix or qmail email
        #
@@ -281,7 +325,7 @@ while (<>) {
                        #
                        # sm-mta:  Jul 28 06:55:13 androneda sm-mta[28877]: h6SDtCtg028877: from=<4cmkh79eob@webtv.net>, size=2556, class=0, nrcpts=1, msgid=<w1$kqj-9-o2m45@0h2i38.4.m0.5u>, proto=ESMTP, daemon=MTA, relay=smtp.easydns.com [205.210.42.50]
                        # postfix: Jul  3 15:32:26 apollon postfix/qmgr[13860]: 08FB63B8A4: from=<nobody@ns3744.ovh.net>, size=3302, nrcpt=1 (queue active)
-                       my ($id,$from,$size)=m/\w+\s+\d+\s+\d+:\d+:\d+\s+\w+\s+(?:sm-mta|sendmail|postfix\/qmgr|postfix\/nqmgr)\[\d+\]:\s+(.*?):\s+from=(.*?),\s+size=(.*?),/;
+                       my ($id,$from,$size)=m/\w+\s+\d+\s+\d+:\d+:\d+\s+\w+\s+(?:sm-mta|sendmail(?:-in|)|postfix\/qmgr|postfix\/nqmgr)\[\d+\]:\s+(.*?):\s+from=(.*?),\s+size=(.*?),/;
                        $rowid=$id;
                        if (! $entry{$id}{'code'}) { $entry{$id}{'code'}=1; }   # If not already defined, we define it
                        if ($entry{$id}{'from'} ne '<>') { $entry{$id}{'from'}=$from; }
@@ -299,7 +343,7 @@ while (<>) {
                        #
                        # Matched arrival sendmail/postfix message
                        #
-                       my ($mon,$day,$time,$id,$to)=m/(\w+)\s+(\d+)\s+(\d+:\d+:\d+)\s+[\w\-]+\s+(?:sm-mta|sendmail|postfix\/(?:local|smtpd|smtp))\[.*?\]:\s+(.*?):\s+to=(.*?),/;
+                       my ($mon,$day,$time,$id,$to)=m/(\w+)\s+(\d+)\s+(\d+:\d+:\d+)\s+[\w\-]+\s+(?:sm-mta|sendmail(?:-out|)|postfix\/(?:local|smtpd|smtp))\[.*?\]:\s+(.*?):\s+to=(.*?),/;
                        $rowid=$id;
                        if (m/\s+relay=([^\s,]*)[\s,]/) { $entry{$id}{'relay_r'}=$1; }
                        elsif (m/\s+mailer=local/) { $entry{$id}{'relay_r'}='localhost'; }