$mail{$mailid}{'mon'}=$mon;
$mail{$mailid}{'day'}=$day;
$mail{$mailid}{'time'}=$time;
+ if (! defined($mail{$mailid}{'size'})) { $mail{$mailid}{'size'}='?'; }
debug("For id=$mailid, found a postfix error incoming message: code=$mail{$mailid}{'code'} from=$mail{$mailid}{'from'} to=$mail{$mailid}{'to'} time=$mail{$mailid}{'time'}");
}
}
#
- # See if we received sendmail reject error
- #
- elsif (/, reject/) {
- $MailType||='sendmail';
- # Example:
- # sm-mta: Jul 27 04:06:05 androneda sm-mta[6641]: h6RB44tg006641: ruleset=check_mail, arg1=<7ms93d4ms@topprodsource.com>, relay=crelay1.easydns.com [216.220.57.222], reject=451 4.1.8 Domain of sender address 7ms93d4ms@topprodsource.com does not resolve
- # sm-mta: Jul 27 06:21:24 androneda sm-mta[11461]: h6RDLNtg011461: ruleset=check_rcpt, arg1=<nobody@nova.dice.net>, relay=freedom.myhostdns.com [66.246.77.42], reject=550 5.7.1 <nobody@nova.dice.net>... Relaying denied
- # sendmail: Sep 30 04:21:32 halley sendmail[3161]: g8U2LVi03161: ruleset=check_rcpt, arg1=<amber3624@netzero.net>, relay=moon.partenor.fr [10.0.0.254], reject=550 5.7.1 <amber3624@netzero.net>... Relaying denied
- my ($mon,$day,$time,$id,$ruleset,$arg,$relay_s,$code)=m/(\w+)\s+(\d+)\s+(\d+:\d+:\d+)\s+[\w\-]+\s+(?:sendmail|sm-mta)\[\d+\]:\s+(.*?):\sruleset=(\w+),\s+arg1=(.*),\s+relay=(.*),\s+(reject=.*)/;
- $mailid=$id;
- if ($mailid) {
- if ($ruleset eq 'check_mail') { $mail{$id}{'from'}=$arg; }
- if ($ruleset eq 'check_rcpt') { $mail{$id}{'to'}=$arg; }
- $mail{$id}{'relay_s'}=$relay_s;
- # $code='reject=550 5.7.1 <amber3624@netzero.net>... Relaying denied'
- if ($code =~ /=(\d\d\d)\s+/) { $mail{$id}{'code'}=$1; }
- else { $mail{$id}{'code'}=999; } # Unkown error
- $mail{$id}{'mon'}=$mon;
- $mail{$id}{'day'}=$day;
- $mail{$id}{'time'}=$time;
- debug("For id=$id, found a sendmail error incoming message: code=$mail{$id}{'code'} from=$mail{$id}{'from'} to=$mail{$id}{'to'} relay_s=$mail{$id}{'relay_s'}");
- }
- }
- #
# See if we received postfix email bounced error
#
elsif (/stat(us)?=bounced/) {
$mail{$mailid}{'mon'}=$mon;
$mail{$mailid}{'day'}=$day;
$mail{$mailid}{'time'}=$time;
+ if (! defined($mail{$mailid}{'size'})) { $mail{$mailid}{'size'}='?'; }
debug("For id=$mailid, found a postfix bounced incoming message: code=$mail{$mailid}{'code'} to=$mail{$mailid}{'to'} relay_r=$mail{$mailid}{'relay_r'}");
}
}
+ #
+ # See if we received sendmail reject error
+ #
+ elsif (/, reject/) {
+ $MailType||='sendmail';
+ # Example:
+ # sm-mta: Jul 27 04:06:05 androneda sm-mta[6641]: h6RB44tg006641: ruleset=check_mail, arg1=<7ms93d4ms@topprodsource.com>, relay=crelay1.easydns.com [216.220.57.222], reject=451 4.1.8 Domain of sender address 7ms93d4ms@topprodsource.com does not resolve
+ # sm-mta: Jul 27 06:21:24 androneda sm-mta[11461]: h6RDLNtg011461: ruleset=check_rcpt, arg1=<nobody@nova.dice.net>, relay=freedom.myhostdns.com [66.246.77.42], reject=550 5.7.1 <nobody@nova.dice.net>... Relaying denied
+ # sendmail: Sep 30 04:21:32 halley sendmail[3161]: g8U2LVi03161: ruleset=check_rcpt, arg1=<amber3624@netzero.net>, relay=moon.partenor.fr [10.0.0.254], reject=550 5.7.1 <amber3624@netzero.net>... Relaying denied
+
+ # sendmail: Jan 10 07:37:48 smtp sendmail[32440]: ruleset=check_relay, arg1=[211.228.26.114], arg2=211.228.26.114, relay=[211.228.26.114], reject=554 5.7.1 Rejected 211.228.26.114 found in dnsbl.sorbs.net
+ # sendmail: Jan 10 07:37:08 smtp sendmail[32439]: ruleset=check_relay, arg1=235.Red-213-97-175.pooles.rima-tde.net, arg2=213.97.175.235, relay=235.Red-213-97-175.pooles.rima-tde.net [213.97.175.235], reject=550 5.7.1 Mail from 213.97.175.235 refused. Rejected for bad WHOIS info on IP of your SMTP server - see http://www.rfc-ignorant.org/\r
+ # sendmail: Jan 10 17:15:42 smtp sendmail[12770]: ruleset=check_relay, arg1=[63.218.84.21], arg2=63.218.84.21, relay=[63.218.84.21], reject=553 5.3.0 Rejected - see http://spamhaus.org/
+ my ($mon,$day,$time,$id,$ruleset,$arg,$relay_s,$code)=m/(\w+)\s+(\d+)\s+(\d+:\d+:\d+)\s+[\w\-]+\s+(?:sendmail|sm-mta)\[\d+\][:\s]*(.*?):\sruleset=(\w+),\s+arg1=(.*),\s+relay=(.*),\s+(reject=.*)/;
+ # sendmail: Jan 10 18:00:34 smtp sendmail[5759]: i04Axx2c005759: Milter: data, reject=511 Virus found in email!\r
+ if (! $mon) { ($mon,$day,$time,$id,$ruleset,$code)=m/(\w+)\s+(\d+)\s+(\d+:\d+:\d+)\s+[\w\-]+\s+(?:sendmail|sm-mta)\[\d+\]:\s+(.*?):\s\w+:\s(\w+),\s+(reject=.*)/; }
+ $mailid=(! $id && $mon?'999':$id); # id not provided in log, we take '999'
+ if ($mailid) {
+ if ($ruleset eq 'check_mail') { $mail{$mailid}{'from'}=$arg; }
+ if ($ruleset eq 'check_rcpt') { $mail{$mailid}{'to'}=$arg; }
+ if ($ruleset eq 'check_relay') { }
+ if ($ruleset eq 'data') { }
+ $mail{$mailid}{'relay_s'}=$relay_s;
+ # $code='reject=550 5.7.1 <amber3624@netzero.net>... Relaying denied'
+ if ($code =~ /=(\d\d\d)\s+/) { $mail{$mailid}{'code'}=$1; }
+ else { $mail{$mailid}{'code'}=999; } # Unkown error
+ $mail{$mailid}{'mon'}=$mon;
+ $mail{$mailid}{'day'}=$day;
+ $mail{$mailid}{'time'}=$time;
+ if (! defined($mail{$mailid}{'size'})) { $mail{$mailid}{'size'}='?'; }
+ debug("For id=$mailid, found a sendmail error incoming message: code=$mail{$mailid}{'code'} from=$mail{$mailid}{'from'} to=$mail{$mailid}{'to'} relay_s=$mail{$mailid}{'relay_s'}");
+ }
+ }
#
# See if we send a sendmail (with ctladdr tag) email
$to=$mail{$mailid}{'to'};
if ($mail{$mailid}{'from'} && $mail{$mailid}{'to'}) { $canoutput=1; }
if ($mail{$mailid}{'from'} && $mail{$mailid}{'code'} > 1) { $canoutput=1; }
+ if ($mailid && $mail{$mailid}{'code'} > 1) { $canoutput=1; }
}
-
+
# If we can
if ($canoutput) {
&OutputRecord($mail{$mailid}{'year'}?$mail{$mailid}{'year'}:$year,$mail{$mailid}{'mon'},$mail{$mailid}{'day'},$mail{$mailid}{'time'},$mail{$mailid}{'from'},$to,$mail{$mailid}{'relay_s'},$mail{$mailid}{'relay_r'},$code,$mail{$mailid}{'size'},$mail{$mailid}{'forwardto'},$mail{$mailid}{'extinfo'});
# the required log format).
# Possible values: 1,2,3,4,5 or "your_own_personalized_log_format"
# 1 - Apache or Lotus Notes/Domino native combined log format (NCSA combined/XLF/ELF log format)
-# 2 - IIS log format (W3C log format)
-# 3 - Webstar native log format
+# 2 - Old IIS log format (IIS W3C log format). See FAQ for IIS 6.x.
+# 3 - Webstar native log format.
# 4 - Apache or Squid native common log format (NCSA common/CLF log format)
# With LogFormat=4, some features (browsers, os, keywords...) can't work.
# "your_own_personalized_log_format" = If your log is ftp, mail or other format,
# LogFormat = 1
# LogFormat = "%host %other %logname %time1 %methodurl %code %bytesd %refererquot %uaquot"
#
-# Examples for IIS (following two examples are equivalent):
-# LogFormat = 2
-# LogFormat = "%time2 %host %logname %method %url %code %bytesd %other %ua %referer"
-#
LogFormat=1
# another site.
# Note: Use space between each value.
# Note: You can use regular expression values writing value with REGEX[value].
-# Example: "www.myserver.com localhost 127.0.0.1 REGEX[\.mydomain\.(net|org)$]"
+# Example: "www.myserver.com localhost 127.0.0.1 REGEX[mydomain\.(net|org)$]"
#
-HostAliases="localhost 127.0.0.1 REGEX[^.*\.myserver\.com$]"
+HostAliases="localhost 127.0.0.1 REGEX[myserver\.com$]"
# If you want to have hosts reported by name instead of ip address, AWStats
# ExtraSectionNameX is title of your personalized chart.
# ExtraSectionConditionalX are conditions you can use to count or not the hit,
# Use one of the field condition (URL, QUERY_STRING, REFERER, UA, HOST),
-# and a regex to match after a coma. Use "|" for "OR". If you use several
-# conditions, they will be combined as "AND".
+# and a regex to match after a coma. Use "|" for "OR".
# ExtraSectionFirstColumnTitleX is the first column title of the chart.
# ExtraSectionFirstColumnValuesX is a Regex string to tell AWStats in which
# field to extract value from (URL, QUERY_STRING, REFERER, UA, HOST) and how
'Day',
'Month',
'Year',
-'Statistics of',
+'Statistics for',
'First visit',
'Last visit',
'Number of visits',
'Nov',
'Dec',
'Navigation',
-'Files type',
+'File type',
'Update now',
'Bandwidth',
'Back to main page',
# Convert extra sections data into @ExtraConditionType, @ExtraConditionTypeVal...
foreach my $extranum (1..@ExtraName-1) {
my $part=0;
- foreach my $conditioncouple (split(/\s\|\s/, $ExtraCondition[$extranum])) {
+ foreach my $conditioncouple (split(/\s*\|\s*/, $ExtraCondition[$extranum])) {
my ($conditiontype, $conditiontypeval)=split(/,/,$conditioncouple,2);
$ExtraConditionType[$extranum][$part]=$conditiontype;
if ($conditiontypeval =~ /^REGEX\[(.*)\]$/i) { $conditiontypeval=$1; }
$part++;
}
$part=0;
- foreach my $rowkeycouple (split(/\s\|\s/, $ExtraFirstColumnValues[$extranum])) {
+ foreach my $rowkeycouple (split(/\s*\|\s*/, $ExtraFirstColumnValues[$extranum])) {
my ($rowkeytype, $rowkeytypeval)=split(/,/,$rowkeycouple,2);
$ExtraFirstColumnValuesType[$extranum][$part]=$rowkeytype;
if ($rowkeytypeval =~ /^REGEX\[(.*)\]$/i) { $rowkeytypeval=$1; }
chomp $_; s/\r//;
@field=split(/\s+/,$_); $countlines++;
}
- until ($field[0] eq 'END_UNKOWNIP' || ! $_);
+ until ($field[0] eq 'END_UNKNOWNIP' || ! $_);
if ($field[0] ne 'END_UNKNOWNIP') { error("History file \"$filetoread\" is corrupted (End of section UNKOWNIP not found).\nRestore a recent backup of this file (data for this month will be restored to backup date), remove it (data for month will be lost), or remove the corrupted section in file (data for at least this section will be lost).","","",1); }
if ($Debug) { debug(" End of UNKOWNIP section ($count entries, $countloaded loaded)"); }
delete $SectionsToLoad{'visitor'};
# Return: decodedstring
#------------------------------------------------------------------------------
sub ChangeWordSeparatorsIntoSpace {
- $_[0] =~ s/%1[03]/ /g; # LF,CR
+ $_[0] =~ s/%0[ad]/ /ig; # LF,CR
$_[0] =~ s/%2[02789abc]/ /ig; #
$_[0] =~ s/%3a/ /ig; # :
$_[0] =~ tr/\+\'\(\)\"\*,:/ /s; # "&" and "=" must not be in this list
my $regnotnetscape=qr/gecko|compatible|opera|galeon|safari/i;
my $regreferer=qr/^(\w+):\/\/([^\/:]+)(:\d+|)/;
my $regreferernoquery=qr/^([^$URLQuerySeparators]+)/;
-
+
# Define value of $PerlParsingFormat and @fieldlib
&DefinePerlParsingFormat();
if ($ExtraAddAverageRow[$extranum]) {
print "<tr>";
print "<td class=\"aws\"><b>$Message[96]</b></td>";
- if ($ExtraStatTypes[$extranum] =~ m/P/i) { print "<td>" . ($total_p/$count) . "</td>"; }
- if ($ExtraStatTypes[$extranum] =~ m/H/i) { print "<td>" . ($total_h/$count) . "</td>"; }
- if ($ExtraStatTypes[$extranum] =~ m/B/i) { print "<td>" . Format_Bytes(($total_k/$count)) . "</td>"; }
+ if ($ExtraStatTypes[$extranum] =~ m/P/i) { print "<td>" . ($count?($total_p/$count):" ") . "</td>"; }
+ if ($ExtraStatTypes[$extranum] =~ m/H/i) { print "<td>" . ($count?($total_h/$count):" ") . "</td>"; }
+ if ($ExtraStatTypes[$extranum] =~ m/B/i) { print "<td>" . ($count?Format_Bytes($total_k/$count):" ") . "</td>"; }
if ($ExtraStatTypes[$extranum] =~ m/L/i) { print "<td> </td>"; }
print "</tr>\n";
}