X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=tools%2Fprivoxy-log-parser.pl;h=d2e1645b5b4f8864da256bf2cab95e56a631feab;hp=481455f56e0209f1d18d114961d09b85b51689e9;hb=2c8cc588b08f0876e8cdf985cf192ecd58233d6c;hpb=e0a1365d9a42490e6063603b2bde1c2f50915298 diff --git a/tools/privoxy-log-parser.pl b/tools/privoxy-log-parser.pl index 481455f5..d2e1645b 100755 --- a/tools/privoxy-log-parser.pl +++ b/tools/privoxy-log-parser.pl @@ -8,7 +8,7 @@ # # http://www.fabiankeil.de/sourcecode/privoxy-log-parser/ # -# $Id: privoxy-log-parser.pl,v 1.140 2012/10/21 13:00:36 fabiankeil Exp $ +# $Id: privoxy-log-parser.pl,v 1.148 2012/12/20 17:03:10 fabiankeil Exp $ # # TODO: # - LOG_LEVEL_CGI, LOG_LEVEL_ERROR, LOG_LEVEL_WRITE content highlighting @@ -25,7 +25,7 @@ # hash key as input. # - Add --compress and --decompress options. # -# Copyright (c) 2007-2010 Fabian Keil +# Copyright (c) 2007-2012 Fabian Keil # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -1611,7 +1611,7 @@ sub handle_loglevel_connect ($) { # Rejecting connection from 178.63.152.227. Maximum number of connections reached. $c =~ s@(?<=onnection from )((?:\d+\.?){3}\d+)@$h{'Number'}$1$h{'Standard'}@; - } elsif ($c =~ m/^(?:Reusing|Closing) server socket \d./ or + } elsif ($c =~ m/^(?:Reusing|Closing) server socket / or $c =~ m/^No additional client request/) { # Reusing server socket 4. Opened for 10.0.0.1. @@ -1619,9 +1619,17 @@ sub handle_loglevel_connect ($) { # No additional client request received in time. \ # Closing server socket 4, initially opened for 10.0.0.1. # No additional client request received in time on socket 29. + # Privoxy 3.0.20 and later + # Reusing server socket 7 connected to www.privoxy.org. Total requests: 2. + # Closing server socket 6 connected to d.asset.soup.io. Keep-alive: 0.\ + # Tainted: 1. Socket alive: 1. Timeout: 60. Configuration file change detected: 0. $c =~ s@(?<= socket )(\d+)@$h{'Number'}$1$h{'Standard'}@; - $c = highlight_matched_host($c, '(?<=for )[^\s]+(?=\.$)'); + $c = highlight_matched_host($c, '(?<=for )[^\s]+(?=\.)'); + $c = highlight_matched_host($c, '(?<=connected to )[^\s]+(?=\.)'); + for my $number_pattern ('requests', 'Keep-alive', 'Tainted', ' alive', 'Timeout', 'detected') { + $c = highlight_matched_pattern($c, 'Number', '(?<='. $number_pattern . ': )\d+'); + } } elsif ($c =~ m/^Connected to /) { @@ -1640,7 +1648,7 @@ sub handle_loglevel_connect ($) { } elsif ($c =~ m/^Waiting for the next client request/ or $c =~ m/^The connection on server socket/ or - $c =~ m/^Client request (?:\d+ )?arrived in time /) { + $c =~ m/^Client request (?:\d+ )?(?:arrived in time|has been pipelined) /) { # Waiting for the next client request on socket 3. Keeping the server \ # socket 12 to a.fsdn.com open. @@ -1651,6 +1659,7 @@ sub handle_loglevel_connect ($) { # Client request arrived in time on socket 21. # Used by earlier version: # Client request arrived in time or the client closed the connection on socket 12. + # Client request 8 has been pipelined on socket 7 and the socket is still alive. $c =~ s@(?<=request )(\d+)@$h{'Number'}$1$h{'Standard'}@; $c =~ s@(?<=on socket )(\d+)@$h{'Number'}$1$h{'Standard'}@; @@ -1692,6 +1701,12 @@ sub handle_loglevel_connect ($) { # Waiting for up to 4999 bytes from the client. $c =~ s@(?<=up to )(\d+)@$h{'Number'}$1$h{'Standard'}@; + } elsif ($c =~ m/^Optimistically sending /) { + + # Optimistically sending 318 bytes of client headers intended for www.privoxy.org + $c =~ s@(?<=sending )(\d+)@$h{'Number'}$1$h{'Standard'}@; + $c = highlight_matched_host($c, '(?<=for )[^\s]+'); + } elsif ($c =~ m/^Stopping to watch the client socket/) { # Stopping to watch the client socket. There's already another request waiting. @@ -1699,6 +1714,23 @@ sub handle_loglevel_connect ($) { # Stopping to watch the client socket 5. There's already another request waiting. $c =~ s@(?<=client socket )(\d+)@$h{'Number'}$1$h{'Standard'}@; + } elsif ($c =~ m/^Drained \d+ bytes before closing/) { + + # Drained 180 bytes before closing socket 6 + $c =~ s@(?<=Drained )(\d+)@$h{'Number'}$1$h{'Standard'}@; + $c =~ s@(?<=socket )(\d+)@$h{'Number'}$1$h{'Standard'}@; + + } elsif ($c =~ m/^Tainting client socket/) { + + # Tainting client socket 7 due to unread data. + $c =~ s@(?<=socket )(\d+)@$h{'Number'}$1$h{'Standard'}@; + + } elsif ($c =~ m/^Shifting \d+ pipelined bytes/) { + + # Shifting 360 pipelined bytes by 360 bytes + $c =~ s@(?<=Shifting )(\d+)@$h{'Number'}$1$h{'Standard'}@; + $c =~ s@(?<=by )(\d+)@$h{'Number'}$1$h{'Standard'}@; + } elsif ($c =~ m/^Looks like we / or $c =~ m/^Unsetting keep-alive flag/ or $c =~ m/^No connections to wait/ or @@ -1708,6 +1740,7 @@ sub handle_loglevel_connect ($) { $c =~ m/^The server still wants to talk, but the client hung up on us./ or $c =~ m/^The server didn't specify how long the connection will stay open/ or $c =~ m/^There might be a request body. The connection will not be kept alive/ or + $c =~ m/^There better be a request body./ or $c =~ m/^Done reading from the client\.$/) { # Looks like we reached the end of the last chunk. We better stop reading. @@ -1725,7 +1758,9 @@ sub handle_loglevel_connect ($) { # The server still wants to talk, but the client hung up on us. # The server didn't specify how long the connection will stay open. Assume it's only a second. # There might be a request body. The connection will not be kept alive. - # Done reading from the client\. + # Privoxy 3.0.20 and later + # There better be a request body. + # Done reading from the client. } else {