Add ExcludedMethods configuration directive to allow exclusion fron statistics of a comma separated list of HTTP methods. Thanks to Ajayaks for the feature request.

This commit is contained in:
Darold Gilles 2014-05-15 19:34:12 +02:00
parent 898ce22b3a
commit ddf635ca17
5 changed files with 29 additions and 1 deletions

6
README
View File

@ -352,6 +352,12 @@ CONFIGURATION
you can have multiple line of the same inclusion type.
item= ExcludedMethods
This directive allow exclusion of some unwanted methods in report
statistics like HEAD, POST, CONNECT, etc. Can be a comma separated
list of methods.
Lang language_file
Used to set the translation file to be used. Value must be set to a
file containing all string translated. See the lang directory for

View File

@ -443,6 +443,9 @@ sub parseFile
$bytes = $5 || 0;
$method = $6 || '';
# Do not parse some unwanted method
next if (grep(/^$method$/, @{$self->{ExcludedMethods}}));
# Go to last parsed date (incremental mode)
next if ($self->{history_time} && ($time <= $self->{history_time}));
@ -735,6 +738,10 @@ sub _init
$self->{DNSLookupTimeout} = int($self->{DNSLookupTimeout} * 1000000);
$self->{pidfile} = $pidfile || '/tmp/squid-analyzer.pid';
$self->{CustomHeader} = $options{CustomHeader} || qq{<a href="$self->{WebUrl}"><img src="$self->{WebUrl}images/logo-squidanalyzer.png" title="SquidAnalyzer $VERSION" border="0"></a> SquidAnalyzer};
$self->{ExcludedMethods} = ();
if ($options{ExcludedMethods}) {
push(@{$self->{ExcludedMethods}}, split(/\s*,\s*/, $options{ExcludedMethods}));
}
if ($self->{Lang}) {
@ -3472,6 +3479,7 @@ sub parse_config
unlink($self->{pidfile});
exit 0;
}
return %opt;
}

View File

@ -374,6 +374,11 @@ See example bellow:
you can have multiple line of the same inclusion type.
item= ExcludedMethods
This directive allow exclusion of some unwanted methods in report statistics
like HEAD, POST, CONNECT, etc. Can be a comma separated list of methods.
=item Lang language_file
Used to set the translation file to be used. Value must be set to

View File

@ -124,7 +124,7 @@
.\" ========================================================================
.\"
.IX Title "SQUIDANALYZER 1"
.TH SQUIDANALYZER 1 "2014-05-04" "perl v5.14.2" "User Contributed Perl Documentation"
.TH SQUIDANALYZER 1 "2014-05-15" "perl v5.14.2" "User Contributed Perl Documentation"
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.if n .ad l
@ -509,6 +509,11 @@ See example bellow:
.Ve
.Sp
you can have multiple line of the same inclusion type.
.Sp
item= ExcludedMethods
.Sp
This directive allow exclusion of some unwanted methods in report statistics
like \s-1HEAD\s0, \s-1POST\s0, \s-1CONNECT\s0, etc. Can be a comma separated list of methods.
.IP "Lang language_file" 4
.IX Item "Lang language_file"
Used to set the translation file to be used. Value must be set to

View File

@ -125,3 +125,7 @@ TopUrlUser 10
# </a> SquidAnalyzer
# Feel free to define your own header but take care to not break current design.
#CustomHeader <a href="http://my.isp.dom/"><img src="http://my.isp.dom/logo.png" title="My ISP link" border="0" width="100" height="110"></a> My ISP Company
# This directive allow exclusion of some unwanted methods in report statistics
# like HEAD, POST, CONNECT, etc. Can be a comma separated list of methods.
#ExcludedMethods HEAD