michael@146: Index: pflogsumm.1 michael@495: --- pflogsumm.1.orig 2012-02-05 23:34:29.000000000 +0100 michael@495: +++ pflogsumm.1 2012-02-06 08:49:47.000000000 +0100 michael@495: @@ -171,6 +171,8 @@ michael@495: \& michael@495: \& \-d today generate report for just today michael@495: \& \-d yesterday generate report for just "yesterday" michael@495: +\& \-d YYYY-MM-DD generate report for just "YYYY-MM-DD" michael@495: +\& (Really takes string Date::Parse will handle) michael@495: \& michael@495: \& \-\-deferral\-detail michael@495: \& michael@146: Index: pflogsumm.pl michael@495: --- pflogsumm.pl.orig 2012-02-05 23:25:25.000000000 +0100 michael@495: +++ pflogsumm.pl 2012-02-06 20:53:39.000000000 +0100 michael@146: @@ -10,7 +10,7 @@ michael@146: michael@146: =head1 SYNOPSIS michael@146: michael@495: - pflogsumm.pl -[eq] [-d ] [--detail ] michael@495: + pflogsumm.pl -[eq] [-d ] [--detail ] michael@495: [--bounce-detail ] [--deferral-detail ] michael@495: [-h ] [-i|--ignore-case] [--iso-date-time] [--mailq] michael@495: [-m|--uucp-mung] [--no-no-msg-size] [--problems-first] michael@495: @@ -43,6 +43,9 @@ michael@146: michael@146: -d today generate report for just today michael@146: -d yesterday generate report for just "yesterday" michael@146: + -d YYYY-MM-DD generate report for just "YYYY-MM-DD" michael@146: + (Actually this will take any date string michael@146: + parsable by the perl Date::Parse module) michael@146: michael@495: --deferral-detail michael@146: michael@495: @@ -398,6 +401,7 @@ michael@146: use strict; michael@146: use locale; michael@146: use Getopt::Long; michael@146: +use Date::Parse; michael@146: eval { require Date::Calc }; michael@146: my $hasDateCalc = $@ ? 0 : 1; michael@146: michael@495: @@ -639,8 +643,8 @@ michael@495: --$msgMon; michael@495: } michael@495: michael@495: - unless((($cmd, $qid) = $logRmdr =~ m#^(?:postfix|$syslogName)(?:/(?:smtps|submission))?/([^\[:]*).*?: ([^:\s]+)#o) == 2 || michael@146: - (($cmd, $qid) = $logRmdr =~ m#^((?:postfix)(?:-script)?)(?:\[\d+\])?: ([^:\s]+)#o) == 2) michael@495: + unless((($cmd, $qid) = $logRmdr =~ m#^<[a-z]+>\s+(?:postfix|$syslogName)(?:/(?:smtps|submission))?/([^\[:]*).*?: ([^:\s]+)#o) == 2 || michael@146: + (($cmd, $qid) = $logRmdr =~ m#^<[a-z]+>\s+((?:postfix)(?:-script)?)(?:\[\d+\])?: ([^:\s]+)#o) == 2) michael@146: { michael@146: #print UNPROCD "$_"; michael@146: next; michael@495: @@ -1514,11 +1518,11 @@ michael@146: # Back up to yesterday michael@146: $time -= ((localtime($time))[2] + 2) * 3600; michael@146: } elsif($dateOpt ne "today") { michael@146: - die "$usageMsg\n"; michael@146: + $time = str2time($dateOpt); michael@146: } michael@495: my ($t_mday, $t_mon, $t_year) = (localtime($time))[3,4,5]; michael@146: michael@495: - return sprintf("%s %2d", $monthNames[$t_mon], $t_mday), sprintf("%04d-%02d-%02d", $t_year+1900, $t_mon+1, $t_mday); michael@495: + return sprintf("%s %02d", $monthNames[$t_mon], $t_mday), sprintf("%04d-%02d-%02d", $t_year+1900, $t_mon+1, $t_mday); michael@146: } michael@146: michael@146: # if there's a real domain: uses that. Otherwise uses the IP addr.