Subject: | Regular Expression fails with log files from Windows servers |
Hi Peter,
First of all, thanks for this nice little module.
I stumbled upon a problem with the regular expressions when a *IX system
processes log files coming from MS Windows servers.
In these cases the generated regular expression will fail because the
end of the line ($) is not directly following the last chunk. This is
the classic \r\n thing in windows. Apache::LogRegex works again if the
regular expression is defined as
/^$regex\s*$/
Note, the trailing '\s*'. This will make the regular expression work
more robust with files of different origin.
A diff of the fix is attached.
I marked this bug as critical because I use your module for some log
file normalisation scripts. This script stopped working after I received
log files from windows servers.
Thanks and cheers
Christian
Subject: | LogRegex.pm.patch |
--- LogRegex.pm 2008-11-20 08:40:31.000000000 +0100
+++ LogRegex.pm.patched 2008-11-20 08:42:14.000000000 +0100
@@ -64,7 +64,7 @@
}
my $regex = join ( ' ', @regex_elements );
- $self->{_regex_string} = qr/^$regex$/;
+ $self->{_regex_string} = qr/^$regex\s*$/;
}
sub parse {