diff --git a/README b/README index fe0123b..dc8adef 100644 --- a/README +++ b/README @@ -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 diff --git a/SquidAnalyzer.pm b/SquidAnalyzer.pm index 8508fd0..c4fbd45 100644 --- a/SquidAnalyzer.pm +++ b/SquidAnalyzer.pm @@ -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{ 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; } diff --git a/doc/SquidAnalyzer.pod b/doc/SquidAnalyzer.pod index 5d22299..40582c9 100644 --- a/doc/SquidAnalyzer.pod +++ b/doc/SquidAnalyzer.pod @@ -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 diff --git a/doc/squidanalyzer.3 b/doc/squidanalyzer.3 index 22bb3e5..7a4b2fc 100644 --- a/doc/squidanalyzer.3 +++ b/doc/squidanalyzer.3 @@ -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 diff --git a/etc/squidanalyzer.conf b/etc/squidanalyzer.conf index 74a1fc6..856d381 100644 --- a/etc/squidanalyzer.conf +++ b/etc/squidanalyzer.conf @@ -125,3 +125,7 @@ TopUrlUser 10 # SquidAnalyzer # Feel free to define your own header but take care to not break current design. #CustomHeader 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