]> git.sven.stormbind.net Git - sven/pflogsumm.git/commitdiff
New upstream version 1.1.9 upstream/1.1.9
authorSven Hoexter <sven@stormbind.net>
Wed, 28 May 2025 10:48:21 +0000 (12:48 +0200)
committerSven Hoexter <sven@stormbind.net>
Wed, 28 May 2025 10:48:21 +0000 (12:48 +0200)
ChangeLog
pffrombyto.1
pflogsumm
pflogsumm.1
pftobyfrom.1

index 9d1c5941d5c494a1f6180dc5b4c539100fdbd820..d554b8617b3931b3c926a8bd7cf470c9016dc307 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,22 @@ ChangeLog for pflogsumm
      http://jimsun.LinxNet.com/postfix_contrib.html.]
 
 
+rel-1.1.9      20250527
+
+    Bugfix: Messages rejected in cleanup were incorrectly counted
+    as received.
+
+    Bugfix: In the unlikely (?) event a qid was used more than once
+    in the same logfile input only the size of the message with the
+    first occurrence of that qid would be counted.
+
+    Bugfix: Eliminated errant debugging message that escaped my
+    attention in versions 1.1.7 and 1.1.8.
+
+    Documentation bugfix: "Addresses" misspelled as "adresses." Thanks
+    and a tip o' the hat to Sven Hoexter (sven-at-stormbind-dot-net) for
+    the heads up.
+
 rel-1.1.8      20250525
 
     Removed the following deprecated options
index fbe0bad859f5b158b938060306c059334a40a8d2..efb1f25a825029a4823238a4bf5fc8ac0c78dd55 100644 (file)
@@ -55,7 +55,7 @@
 .\" ========================================================================
 .\"
 .IX Title "PFFROMBYTO 1"
-.TH PFFROMBYTO 1 2025-05-22 1.1.8 "User Contributed Perl Documentation"
+.TH PFFROMBYTO 1 2025-05-22 1.1.9 "User Contributed Perl Documentation"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
index 42a48e34f29e717ab7177267b08b19ece370094e..561651b45f9acdd9f4b07e00f1c1ef94b50a8adb 100755 (executable)
--- a/pflogsumm
+++ b/pflogsumm
@@ -6,7 +6,7 @@ eval 'exec perl -S $0 "$@"'
 
 pflogsumm - Produce Postfix MTA logfile summary
 
-Copyright (C) 1998-2025 by James S. Seymour, Release 1.1.8
+Copyright (C) 1998-2025 by James S. Seymour, Release 1.1.9
 
 =head1 SYNOPSIS
 
@@ -184,7 +184,7 @@ Copyright (C) 1998-2025 by James S. Seymour, Release 1.1.8
 
                   If your postfix install has an SRS plugin running, many
                    addresses in the report will contain the SRS-formatted
-                   email addresses, also for non-local adresses (f.i.
+                   email addresses, also for non-local addresses (f.i.
                    senders). This option will try to undo the "damage".
 
                    Addresses of the form:
@@ -411,7 +411,7 @@ eval { require Date::Calc };
 my $hasDateCalc = $@ ? 0 : 1;
 
 my $mailqCmd = "mailq";
-my $release = "1.1.8";
+my $release = "1.1.9";
 
 # Variables and constants used throughout pflogsumm
 use vars qw(
@@ -463,7 +463,6 @@ my (
     $cmd, $qid, $addr, $orig_to, $size, $relay, $status, $delay,
     $dateStr, $dateStrRFC3339,
     %panics, %fatals, %warnings, %masterMsgs,
-    %msgSizes,
     %deferred, %bounced,
     %noMsgSize, %msgDetail,
     $msgsRcvd, $msgsDlvrd, $sizeRcvd, $sizeDlvrd,
@@ -666,6 +665,7 @@ while(<>) {
        if($rejSubTyp eq "reject" or $rejSubTyp eq "milter-reject") {
            ++$rejects{$cmd}{$rejReas}{$rejRmdr} unless($opts{'rejectDetail'} == 0);
            ++$msgsRjctd;
+           --$msgsRcvd;                # It will have already been counted as "Received," even though it ultimately is not
        } elsif($rejSubTyp eq "warning") {
            ++$warns{$cmd}{$rejReas}{$rejRmdr} unless($opts{'rejectDetail'} == 0);
            ++$msgsWrnd;
@@ -676,6 +676,7 @@ while(<>) {
            ++$discards{$cmd}{$rejReas}{$rejRmdr} unless($opts{'rejectDetail'} == 0);
            ++$msgsDscrdd;
        }
+       delete($rcvdMsg{$qid}); # We're done with this
        ++$rejPerHr[$msgHr];
        ++${$msgsPerDay{$revMsgDateStr}}[4];
     } elsif($qid eq 'warning') {
@@ -735,9 +736,7 @@ while(<>) {
            ++$rcvPerHr[$msgHr];
            ++${$msgsPerDay{$revMsgDateStr}}[0];
            ++$msgsRcvd;
-           $rcvdMsg{$qid} = gimme_domain($1);  # Whence it came
-           # DEBUG DEBUG DEBUG
-           #print STDERR "Received: $qid\n";
+           $rcvdMsg{$qid}{'whence'} = gimme_domain($1);        # Whence it came
        } elsif(my($rejSubTyp) = $logRmdr =~ /\[\d+\]: \w+: (reject(?:_warning)?|hold|discard): /) {
            if($rejSubTyp eq 'reject') {
                proc_smtpd_reject($logRmdr, \%rejects, \$msgsRjctd,
@@ -803,7 +802,7 @@ while(<>) {
        my $toRmdr;
        if((($addr, $size) = $logRmdr =~ /from=<([^>]*)>, size=(\d+)/) == 2)
        {
-           next if($msgSizes{$qid});   # avoid double-counting!
+           next if($rcvdMsg{$qid}{'size'});    # avoid double-counting!
            if($addr) {
                if($opts{'m'} && $addr =~ /^(.*!)*([^!]+)!([^!@]+)@([^\.]+)$/) {
                    $addr = "$4!" . ($1? "$1" : "") . $3 . "\@$2";
@@ -815,15 +814,15 @@ while(<>) {
            } else {
                $addr = "from=<>"
            }
-           $msgSizes{$qid} = $size;
+           $rcvdMsg{$qid}{'size'} = $size;
            push(@{$msgDetail{$qid}}, $addr) if($opts{'e'});
            # Avoid counting forwards
-           if($rcvdMsg{$qid}) {
+           if($rcvdMsg{$qid}{'whence'}) {
                # Get the domain out of the sender's address.  If there is
-               # none: Use the client hostname/IP-address
+               # none: Use the client domain/IP-address
                my $domAddr;
                unless((($domAddr = $addr) =~ s/^[^@]+\@(.+)$/$1/) == 1) {
-                   $domAddr = $rcvdMsg{$qid} eq "pickup"? $addr : $rcvdMsg{$qid};
+                   $domAddr = $rcvdMsg{$qid}{'whence'} eq "pickup"? $addr : $rcvdMsg{$qid}{'whence'};
                }
                ++$sendgDomCnt
                    unless(${$sendgDom{$domAddr}}[MSG_CNT_I]);
@@ -833,7 +832,6 @@ while(<>) {
                ++${$sendgUser{$addr}}[MSG_CNT_I];
                ${$sendgUser{$addr}}[MSG_SIZE_I] += $size;
                $sizeRcvd += $size;
-               delete($rcvdMsg{$qid});         # limit hash size
            }
        }
        elsif((($addr, $orig_to, $relay, $delay, $status, $toRmdr) = $logRmdr =~
@@ -851,8 +849,9 @@ while(<>) {
            if($status eq 'sent') {
 
                # was it actually forwarded, rather than delivered?
-               if($toRmdr =~ /forwarded as /) {
+               if((my $newQid) = ($toRmdr =~ /\(forwarded as ([^\)]+)\)/)) {
                    ++$msgsFwdd;
+                   delete($rcvdMsg{$qid});             # We're done with this
                    next;
                }
                ++$recipDomCnt unless(${$recipDom{$domAddr}}[MSG_CNT_I]);
@@ -868,12 +867,10 @@ while(<>) {
                ++$dlvPerHr[$msgHr];
                ++${$msgsPerDay{$revMsgDateStr}}[1];
                ++$msgsDlvrd;
-               # DEBUG DEBUG DEBUG
-               #print STDERR "Delivered: $qid\n";
-               if($msgSizes{$qid}) {
-                   ${$recipDom{$domAddr}}[MSG_SIZE_I] += $msgSizes{$qid};
-                   ${$recipUser{$addr}}[MSG_SIZE_I] += $msgSizes{$qid};
-                   $sizeDlvrd += $msgSizes{$qid};
+               if($rcvdMsg{$qid}{'size'}) {
+                   ${$recipDom{$domAddr}}[MSG_SIZE_I] += $rcvdMsg{$qid}{'size'};
+                   ${$recipUser{$addr}}[MSG_SIZE_I] += $rcvdMsg{$qid}{'size'};
+                   $sizeDlvrd += $rcvdMsg{$qid}{'size'};
                } else {
                    ${$recipDom{$domAddr}}[MSG_SIZE_I] += 0;
                    ${$recipUser{$addr}}[MSG_SIZE_I] += 0;
@@ -923,7 +920,6 @@ while(<>) {
                    my ($bounceReas) = $logRmdr =~ /, status=bounced \((.+)\)/;
                    unless(defined($opts{'verbMsgDetail'})) {
                        $bounceReas = said_string_trimmer($bounceReas, 66);
-                       $bounceReas =~ s/^\d{3} //;
                    }
                    ++$bounced{$relay}{$bounceReas};
                }
@@ -941,7 +937,7 @@ while(<>) {
            ++$rcvPerHr[$msgHr];
            ++${$msgsPerDay{$revMsgDateStr}}[0];
            ++$msgsRcvd;
-           $rcvdMsg{$qid} = "pickup";  # Whence it came
+           $rcvdMsg{$qid}{'whence'} = "pickup";        # Whence it came
        }
        elsif($cmd eq 'smtp' && $opts{'smtpDetail'} != 0) {
            # Was an IPv6 problem here
@@ -953,6 +949,9 @@ while(<>) {
                print $unProcd "$_\n" if $unProcd;
            }
        }
+       elsif($cmd =~ /^n?qmgr$/ && $logRmdr =~ /\bremoved$/) {
+           delete($rcvdMsg{$qid});             # We're done with this
+       }
        else
        {
            print $unProcd "$_\n" if $unProcd;
@@ -1583,7 +1582,6 @@ sub gimme_domain {
     my $slashSepRegex = '([^\s\/]+)\/((?:\d{1,3}\.){3}\d{1,3}|[\da-fA-F:]+(?:::(?:[\da-fA-F:]+)?)?|[\da-fA-F:]+:(?:\d{1,3}\.){3}\d{1,3})';
     my ($fqdn, $ipaddr);
 
-    print STDERR "dbg: \$_: \"$_\"\n" if(/unknown=0/);
     unless((($fqdn, $ipaddr) = /$bracketRegex/i) == 2) {
        ($fqdn, $ipaddr) = /$slashSepRegex/i;
     }
index 1b8dbefa388684cc73de8f5c11e8e62432bb429d..488ce95102028a3d8fbe39abb504f023bca4f94e 100644 (file)
@@ -55,7 +55,7 @@
 .\" ========================================================================
 .\"
 .IX Title "PFLOGSUMM 1"
-.TH PFLOGSUMM 1 2025-05-25 1.1.8 "User Contributed Perl Documentation"
+.TH PFLOGSUMM 1 2025-05-27 1.1.9 "User Contributed Perl Documentation"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l
@@ -63,7 +63,7 @@
 .SH NAME
 pflogsumm \- Produce Postfix MTA logfile summary
 .PP
-Copyright (C) 1998\-2025 by James S. Seymour, Release 1.1.8
+Copyright (C) 1998\-2025 by James S. Seymour, Release 1.1.9
 .SH SYNOPSIS
 .IX Header "SYNOPSIS"
 .Vb 8
@@ -243,7 +243,7 @@ Copyright (C) 1998\-2025 by James S. Seymour, Release 1.1.8
 \&
 \&                   If your postfix install has an SRS plugin running, many
 \&                   addresses in the report will contain the SRS\-formatted
-\&                   email addresses, also for non\-local adresses (f.i.
+\&                   email addresses, also for non\-local addresses (f.i.
 \&                   senders). This option will try to undo the "damage".
 \&
 \&                   Addresses of the form:
index b41e649c94d59f97fd961c5e98e422c4eb6f52fb..4d59013fe737b15bae4799bbda46d4e8963eae3b 100644 (file)
@@ -55,7 +55,7 @@
 .\" ========================================================================
 .\"
 .IX Title "PFTOBYFROM 1"
-.TH PFTOBYFROM 1 2025-05-22 1.1.8 "User Contributed Perl Documentation"
+.TH PFTOBYFROM 1 2025-05-22 1.1.9 "User Contributed Perl Documentation"
 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
 .\" way too many mistakes in technical documents.
 .if n .ad l