# HG changeset patch # User Heiko Schlittermann # Date 1259736480 -3600 # Node ID 5758f12ce2d784987cdaa113a1bb49fe17a7d4d9 # Parent 63072e0d02a6ddeb196eb7e71d0278374ebb441c reformatted [perltidy] diff -r 63072e0d02a6 -r 5758f12ce2d7 postgrep --- a/postgrep Wed Dec 02 07:47:31 2009 +0100 +++ b/postgrep Wed Dec 02 07:48:00 2009 +0100 @@ -16,20 +16,21 @@ while (<>) { - if (!/^(?.{15}) + if ( + !/^(?.{15}) \s(?\S+) \s(?\S+): \s(?[[:xdigit:]]+): - \s(?.*)/x) { - - print "$_\n" if /$pattern/i; - next; - + \s(?.*)/x + ) + { + print "$_\n" if /$pattern/i; + next; } my $ts = str2time($+{date}); - push @{$msglog{$+{pfid}}}, $_; + push @{ $msglog{ $+{pfid} } }, $_; # a "removed" line does not have to be the last # line for a message, sometimes the qmgr logs a bit @@ -37,24 +38,23 @@ # thus remember the "removed" ID we've seen if ($+{rest} eq "removed") { - push @{$removed{$ts}}, $+{pfid}; + push @{ $removed{$ts} }, $+{pfid}; } # and count all IDs with "removed" older than 60 seconds as # completed foreach (grep { ($ts - $_) > 60 } keys %removed) { - foreach (@{delete $removed{$_}}) { - print @{delete $msglog{$_}}, "\n" - if /$pattern/i ~~ @{$msglog{$_}}; - } + foreach (@{ delete $removed{$_} }) { + print @{ delete $msglog{$_} }, "\n" + if /$pattern/i ~~ @{ $msglog{$_} }; + } } - } -# the rest +# the rest foreach (values %msglog) { print join @$_, "\n" - if /$pattern/ ~~ @{$msglog{$_}}; + if /$pattern/ ~~ @{ $msglog{$_} }; }