use strict; use warnings; use Carp; sub run { my ($self) = shift; my $args = $self->{args}; my $post_method = "POST"; my $get_method = "GET .*=(htt|ft|ph)p(:|%3[aA])(/|%2[fF])"; my $method_string = '\"('.$post_method.' |'.$get_method.')'; if ( (defined $args->{method}) && ($#{$args->{method}} + 1 == 1) ) { if (grep lc($_) eq "post", @{$args->{method}}) { $method_string = '\"'.$post_method; } elsif (grep lc($_) eq "get", @{$args->{method}}) { $method_string = '\"('.$get_method.')'; } } my $command = "find ".$args->{docroot}."/logs/ -maxdepth 1 -type f -name access.log\* | xargs -r -n1 -P10 /bin/zgrep -E \" ".$method_string.".* HTTP/[0-9]\\\.[0-9]\\\" [23][0-9]{2}\""; open FH, "-|", $command; local $/; my $output=; close FH; return $output; } 1;