michael@146: This patch makes Pflogsumm working with the particular format michael@146: of the OSSP fsl based Postfix logfile and additionally allows michael@146: one to specify a more flexible data format. michael@146: michael@146: Index: pflogsumm.1 michael@146: --- pflogsumm.1.orig 2007-04-06 16:11:28 +0200 michael@146: +++ pflogsumm.1 2007-04-06 17:35:12 +0200 michael@146: @@ -172,6 +172,8 @@ michael@146: .Vb 2 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: +\& (Really takes string Date::Parse will handle) michael@146: .Ve michael@146: .PP michael@146: .Vb 1 michael@146: Index: pflogsumm.pl michael@146: --- pflogsumm.pl.orig 2008-06-29 15:46:01 +0200 michael@146: +++ pflogsumm.pl 2008-06-29 19:39:07 +0200 michael@146: @@ -10,7 +10,7 @@ michael@146: michael@146: =head1 SYNOPSIS michael@146: michael@146: - pflogsumm.pl -[eq] [-d ] [-h ] [-u ] michael@146: + pflogsumm.pl -[eq] [-d ] [-h ] [-u ] michael@146: [--verp_mung[=]] [--verbose_msg_detail] [--iso_date_time] michael@146: [-m|--uucp_mung] [-i|--ignore_case] [--smtpd_stats] [--mailq] michael@146: [--problems_first] [--rej_add_from] [--no_bounce_detail] michael@146: @@ -37,6 +37,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@146: -e extended (extreme? excessive?) detail michael@146: michael@146: @@ -359,6 +362,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@146: @@ -542,8 +546,8 @@ michael@146: my $logRmdr; michael@146: next unless((($msgMonStr, $msgDay, $msgHr, $msgMin, $msgSec, $logRmdr) = michael@146: /^(...) +(\d+) (..):(..):(..) \S+ (.+)$/o) == 6); michael@146: - unless((($cmd, $qid) = $logRmdr =~ m#^(?:postfix|$syslogName)/([^\[:]*).*?: ([^:\s]+)#o) == 2 || michael@146: - (($cmd, $qid) = $logRmdr =~ m#^((?:postfix)(?:-script)?)(?:\[\d+\])?: ([^:\s]+)#o) == 2) michael@146: + unless((($cmd, $qid) = $logRmdr =~ m#^<[a-z]+>\s+(?:postfix|$syslogName)/([^\[:]*).*?: ([^:\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@146: @@ -1406,11 +1410,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@146: my ($t_mday, $t_mon) = (localtime($time))[3,4]; michael@146: michael@146: - return sprintf("%s %2d", $monthNames[$t_mon], $t_mday); michael@146: + return sprintf("%s %02d", $monthNames[$t_mon], $t_mday); michael@146: } michael@146: michael@146: # if there's a real domain: uses that. Otherwise uses the IP addr.