[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Unknown User message in sendmail maillog.
On Fri, Jan 31, 2003 at 09:36:11AM -0600, Steven Pritchard wrote:
> Hmm... Looks like I'll need to make an optimization pass before I can
> effectively use that myself. It's taking a *really* long time to run
> on the mail server here. :-)
This isn't as accurate, but it takes 5.36 seconds to execute, vs. 53
minutes and change for the first version. :-)
#!/usr/bin/perl
while (<>) {
chomp;
if (/\ssendmail\[\d+\]:\s+(\w+):\s+.*\<([^\>]+)\>.*User unknown$/) {
push(@{$log{$1}}, $2);
} elsif (/\ssendmail\[\d+\]:\s+(\w+):\s+(.*)$/ and $log{$1}) {
push(@{$log{$1}}, $2);
}
}
for my $id (keys(%log)) {
my $to=shift(@{$log{$id}});
for my $msg (@{$log{$id}}) {
if ($msg =~ /^from=\<([^\>]+)\>.*relay=[^\[]*\[([\d\.]+)\]$/) {
print "from=<$1> to=<$to> relay=<$2>\n";
last;
}
}
}
Steve
--
steve@silug.org | Southern Illinois Linux Users Group
(618)398-7360 | See web site for meeting details.
Steven Pritchard | http://www.silug.org/
-
To unsubscribe, send email to majordomo@luci.org with
"unsubscribe luci-discuss" in the body.