Micah Anderson schrieb am Thursday, den 07. April 2005:
> elsif (($line =~ /reject: \S+ \S+ \S+ (\d{3})/)
sorry, that should be:
elsif ($line =~ /reject: \S+ \S+ \S+ (\d{3})/)
the attached patch should be used instead of the previous.
Micah
--- postfix_mailstats 2005-03-31 18:37:38.000000000 -0800
+++ /tmp/postfix_mailstats 2005-04-07 21:29:11.133181723 -0700
@@ -229,7 +229,29 @@
{
$delivered++;
}
- elsif (($line =~ /reject: \S+ \S+ \S+ (\S+)/) && (!($line =~
/\/cleanup\[\d+\].*reject:/)))
+
+ # Look for lines that have reject: in them, and count up the number of
reject codes
+ # For example, the following entry would increase the counter for
reject code 554
+ #
+ # postfix/smtpd[18762]: NOQUEUE: reject: RCPT from
somehost.edu[xxx.xxx.xxx.xxx]: 554 Service unavailable;
+ # Client host [xxx.xxx.xxx.xxx] blocked using list.dsbl.org
from=<[EMAIL PROTECTED]>
+ # to=<[EMAIL PROTECTED]> proto=SMTP helo=<somehost.edu>
+ #
+ # but there are some cases where reject codes are not included, so we
ignore the following cases (possibly more!):
+ #
+ # postfix/cleanup[22101]: F28EF3D318: reject: header Subject: Important
notify about your e-mail account. from
+ # somehost.edu[xxx.xxx.xxx.xxx]; from=<[EMAIL
PROTECTED]> to=<[EMAIL PROTECTED]>
+ # proto=SMTP helo=<Viking1>: Rejected, probably
sent by virus W32/Bagle
+ #
+ # postfix/smtpd[26330]: warning: reject: ETRN from
somehost.edu[xxx.xxx.xxx.xxx]
+ #
+ # This was being done this way:
+ #
+ # elsif (($line =~ /reject: \S+ \S+ \S+ (\S+)/) && (!($line =~
/\/cleanup\[\d+\].*reject:/)) && (!($line =~ /reject: ETRN/)))
+ #
+ # but could be done much simpler this way (I think):
+
+ elsif ($line =~ /reject: \S+ \S+ \S+ (\d{3})/)
{
$rejects->{$1} ++;
}