Skip to content

Commit

Permalink
escape \ character (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
matyaskopp committed Nov 10, 2021
1 parent 9363c64 commit 506ad7d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion scripts/log2sql.pl
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,10 @@
while(my $line = <LOG>){
$lines_read++;
$line =~ s/\n$//;
my $escapedline = $line;
$escapedline =~ s/\\/\\\\/g;
my ($remote_addr, $remote_user, $time_local, $method, $request, $protocol, $status, $body_bytes_sent,$http_referer, $http_user_agent, $unit) =
$line =~ /^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+) - ([^\s]+) \[(\d{2}\/\w{3}\/\d{4}:\d{2}:\d{2}:\d{2} \+\d{4})\] +"([A-Z]+) ([^" ]*) ([^" ]*)" (2\d\d) ([-\d]*) "([^"]*)" "([^"]*)" [^\s]* [^\s]* [^\s](?: .*billing:infclen=(\d+))?/;
$escapedline =~ /^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+) - ([^\s]+) \[(\d{2}\/\w{3}\/\d{4}:\d{2}:\d{2}:\d{2} \+\d{4})\] +"([A-Z]+) ([^" ]*) ([^" ]*)" (2\d\d) ([-\d]*) "([^"]*)" "([^"]*)" [^\s]* [^\s]* [^\s](?: .*billing:infclen=(\d+))?/;
$unit //=0;
if($status && $request !~ /$ignore/){
$last_read_line_checksum = Digest::MD5::md5_hex($line);
Expand Down

0 comments on commit 506ad7d

Please sign in to comment.