This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.
From: "Anthony E. Greene" <agreene@pobox.com>
Date: Mon, 05 Apr 1999 00:25:27 +0200 (CEST)
Subject: RE: Script to summarize Procmail Log ?
On 04-Apr-99 Anthony E. Greene wrote:
> I'd like to view a summary of procmail's log after my mail is
> downloaded.
> I just want to see a list of folders and the number of messages filtered
> into each one. Does anyone know where I can find something like this?
>
> I could write it using perl, but this sounds like something that may
> already have been done.
If anyone is interested, I hacked a quick & dirty perl script to do this.
It takes the sorted, filtered, logfile data on STDIN using
grep "^ Folder: " <logfile> | sort | pmaillog | xless &
The pipe to xless is optional of course.
#!/usr/bin/perl
#
# Script: pmaillog
#
# Purpose: Summarizes procmail log; displays folder names
# and message count for each folder
#
# Author: Anthony E. Greene <agreene@pobox.com>
#
# License: GNU GPL
#
# Notes: Script expects to get logfile data from STDIN.
# Data should be filtered into pmaillog as follows:
#
# grep "^ Folder: " $logfile | sort | pmaillog
#
# Summary is printed to STDOUT.
#
$oldfolder = '';
$currdate = `date`;
print "Procmail Filter Report\n";
print "$currdate\n";
print "Msgs\tFolder\n";
print "----\t------------------------\n";
while ($line = <STDIN>) {
chomp $line;
@folline = split(/ /,$line);
$folder = @folline[3];
$folder =~ tr/\t//d;
if ($folder eq $oldfolder) {
$msgcount = $msgcount + 1;
} else {
if ($msgcount > 0) {
print "$msgcount\t$oldfolder\n\n";
}
$oldfolder = $folder;
$msgcount = 1;
}
}
===
From: Stefan Miltchev <miltchev@panther.middlebury.edu>
Date: Sun, 4 Apr 1999 18:34:24 -0400 (EDT)
Subject: RE: Script to summarize Procmail Log ?
check out mailstat, it is part of the procmail rpm.
===