From 16be72affaf4c03bfca55cb1dc0faf4d7cde6f8b Mon Sep 17 00:00:00 2001 From: biji Date: Wed, 6 Feb 2019 17:05:03 +0700 Subject: [PATCH 1/3] fix postfix amavis log contains no Message-ID --- sendmailanalyzer | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sendmailanalyzer b/sendmailanalyzer index 91b4e42..0cdf737 100755 --- a/sendmailanalyzer +++ b/sendmailanalyzer @@ -1770,7 +1770,7 @@ sub parse_amavis $SPAMDETAIL{$host}{$id}{spam} = $SPAM{$host}{$id}{spam}; } - } elsif ($str =~ /\(([^\)]+)\) (Passed|Blocked) SPAM(.*?) [<]*([^\s>]*)[>]* -> [<]*([^,>]*)[>]*,(.*) Message-ID: [<]*([^,>]+)[>]*, (.*)/) { + } elsif ($str =~ /\(([^\)]+)\) (Passed|Blocked) SPAM(.*?) [<]*([^\s>]*)[>]* -> [<]*([^,>]*)[>]*, (Queue-ID: .*?), (.*)/) { my $pid = $1; my $status = $2; @@ -1779,7 +1779,7 @@ sub parse_amavis my $queueid = $6; my $sender = &edecode($4); my $to = &edecode($5); - my $other = $8; + my $other = $7; if ($queueid =~ /Queue-ID: ([^,]+)/) { $id = $1; } elsif ($other =~ /queued_as: ([^,]+)/) { From 7c76be4b371ff51b25163cdc8553ec35e819e499 Mon Sep 17 00:00:00 2001 From: biji Date: Thu, 7 Feb 2019 15:37:34 +0700 Subject: [PATCH 2/3] $id always = queue-id --- sendmailanalyzer | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sendmailanalyzer b/sendmailanalyzer index 9cef71f..851ac97 100755 --- a/sendmailanalyzer +++ b/sendmailanalyzer @@ -1771,12 +1771,11 @@ sub parse_amavis $SPAMDETAIL{$host}{$id}{spam} = $SPAM{$host}{$id}{spam}; } - } elsif ($str =~ /\(([^\)]+)\) (Passed|Blocked) SPAM(.*?) [<]*([^\s>]*)[>]* -> [<]*([^,>]*)[>]*, (Queue-ID: .*?), (.*)/) { + } elsif ($str =~ /\(([^\)]+)\) (Passed|Blocked) SPAM(.*?) [<]*([^\s>]*)[>]* -> [<]*([^,>]*)[>]*, Queue-ID: (.*?), (.*)/) { my $pid = $1; my $status = $2; my $relay = lc($3); - $id = $7; my $queueid = $6; my $sender = &edecode($4); my $to = &edecode($5); From 1a05ce0719f951c55f84bea619ca78d5b280ed51 Mon Sep 17 00:00:00 2001 From: biji Date: Fri, 8 Feb 2019 11:02:27 +0700 Subject: [PATCH 3/3] queue-id --- sendmailanalyzer | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/sendmailanalyzer b/sendmailanalyzer index 851ac97..77505e1 100755 --- a/sendmailanalyzer +++ b/sendmailanalyzer @@ -1777,17 +1777,10 @@ sub parse_amavis my $status = $2; my $relay = lc($3); my $queueid = $6; + $id = $queueid; my $sender = &edecode($4); my $to = &edecode($5); my $other = $7; - if ($queueid =~ /Queue-ID: ([^,]+)/) { - $id = $1; - } elsif ($other =~ /queued_as: ([^,]+)/) { - $id = $1; - } elsif ($str =~ /mail_id: ([^,]+)/) { - # Quarantine id - $id = $1; - } $SPAM{$host}{$id}{from} = $sender; push(@{$SPAM{$host}{$id}{to}}, $to); $SPAM{$host}{$id}{spam} = "Amavis $status Spam";