[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[Fwd: Re: Postfix log analizer]





-------- Original Message --------
Subject: Re: Postfix log analizer
Date: Tue, 01 Apr 2003 16:40:32 +0100
From: mimo <mimo@restoel.net>
To: Teun Vink <teun@moonblade.net>
References: <[🔎] 656F04F343FC25409463829A15B5FDDC08B092@netwake-nt.netwake.de> <[🔎] 1049288019.1981.21.camel@foobar.utah.inet> <[🔎] 1049295249.4429.60.camel@tux>

Here is my lsmail script - usage:

lsmail <regex> [optional: log file extension, .1,.2, etc]

ex: lsmail "from=<mimo" ".1"

looks for all email I have sent yesterday

mm

#!/usr/bin/perl
#03 mimo / GN
my ($pattern,$ext) = @ARGV;
$maillog="/var/log/maillog".$ext;
#$pattern="$ARGV[0]";
print("$pattern");
open(INFILE,$maillog);
@lines;
$linecount=0;
while(<INFILE>) {
         $line = $_;
         if(m/$pattern/) {
#               print "$line \n";
                 @fields = split(/\s+/, $line);
#               print "@fields\n";
#               print "@fields[5]\n";
                 if($fields[5] =~ /(\d+)/) {
#                       print("$fields[5]\n");
                         $lines[$linecount++]=$fields[5];
                 }
         }
}
foreach $i (@lines) {
         system("grep $i $maillog");
}



Teun Vink wrote:
On Wed, 2003-04-02 at 14:53, Andre Luis Lopes wrote:
[..]

  Actually, I'm already using pflogsum but it doesn't seems to support
generating the kind of report I'm looking for. It's good enough for
generating statistics about a lot of useful data, but what I would like
to see in a report is something like :

Message ID    Sender               Recipient           Size
XXXXX         user@mydomain        user@somewhere       XXX



This shouldn't be too hard to do with some grepping/regexp'ing on
mailserver logs, now should it?


The size is not that important.


Who made you believe that? ;-)



Teun

--
BOFH excuse #103: operators on strike due to broken coffee machine






Reply to: