projects
/
privoxy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1452755
)
privoxy-log-parser.pl: Include status code distribution in the stats
author
Fabian Keil
<fk@fabiankeil.de>
Sat, 30 May 2020 04:15:11 +0000
(06:15 +0200)
committer
Fabian Keil
<fk@fabiankeil.de>
Mon, 1 Jun 2020 08:11:46 +0000
(10:11 +0200)
tools/privoxy-log-parser.pl
patch
|
blob
|
history
diff --git
a/tools/privoxy-log-parser.pl
b/tools/privoxy-log-parser.pl
index
c24b89b
..
470b5d2
100755
(executable)
--- a/
tools/privoxy-log-parser.pl
+++ b/
tools/privoxy-log-parser.pl
@@
-2010,6
+2010,7
@@
sub gather_loglevel_clf_stats ($) {
$stats{'hosts'}{$1}++;
}
$stats{'content-size-total'} += $size;
$stats{'hosts'}{$1}++;
}
$stats{'content-size-total'} += $size;
+ $stats{'status-code'}{$status_code}++;
}
sub gather_loglevel_request_stats ($$) {
}
sub gather_loglevel_request_stats ($$) {
@@
-2238,6
+2239,14
@@
sub print_stats () {
foreach my $http_version (sort {$stats{'http-version'}{$b} <=> $stats{'http-version'}{$a}} keys %{$stats{'http-version'}}) {
printf "%d : %s\n", $stats{'http-version'}{$http_version}, $http_version;
}
foreach my $http_version (sort {$stats{'http-version'}{$b} <=> $stats{'http-version'}{$a}} keys %{$stats{'http-version'}}) {
printf "%d : %s\n", $stats{'http-version'}{$http_version}, $http_version;
}
+ if (exists $stats{'status-code'}) {
+ print "HTTP status codes:\n";
+ foreach my $status_code (sort {$stats{'status-code'}{$b} <=> $stats{'status-code'}{$a}} keys %{$stats{'status-code'}}) {
+ printf "%8d : %-8d\n", $stats{'status-code'}{$status_code}, $status_code;
+ }
+ } else {
+ print "Status code distribution unknown. No CLF message parsed yet. Is 'debug 512' enabled?\n";
+ }
if ($cli_options{'url-statistics-threshold'} == 0) {
print "URL statistics are disabled. Increase --url-statistics-threshold to enable them.\n";
if ($cli_options{'url-statistics-threshold'} == 0) {
print "URL statistics are disabled. Increase --url-statistics-threshold to enable them.\n";