Apache-Logmonster
view release on metacpan or search on metacpan
lib/Apache/Logmonster.pm view on Meta::CPAN
sub spam_check {
my ($self, $data, $count) = @_;
my $conf = $self->{conf};
return if ! $conf->{spam_check};
my $spam_score = 0;
# check for spam quotient
if ( $data->{status} ) {
if ( $data->{status} == 404 ) { # check for 404 status
$spam_score++; # a 404 alone is not a sign of naughtiness
}
if ( $data->{status} == 412 ) { # httpd config slapping them
$spam_score++;
}
if ( $data->{status} == 403 ) { # httpd config slapping them
$spam_score += 2;
}
}
lib/Apache/Logmonster/Utility.pm view on Meta::CPAN
my $uri = URI->new($url);
my @parts = $uri->path_segments;
my $file = $parts[-1]; # everything after the last / in the URL
my $file_path = $file;
$file_path = "$dir/$file" if $dir;
$log->audit( "fetching $url" );
eval { $response = LWP::Simple::mirror($url, $file_path ); };
if ( $response ) {
if ( $response == 404 ) {
return $log->error( "file not found ($url)", %args );
}
elsif ($response == 304 ) {
$log->audit( "result 304: file is up-to-date" );
}
elsif ( $response == 200 ) {
$log->audit( "result 200: file download ok" );
}
else {
$log->error( "unhandled response: $response", fatal => 0 );
( run in 1.407 second using v1.01-cache-2.11-cpan-39bf76dae61 )