line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Logfile::SmartFilter; |
2
|
1
|
|
|
1
|
|
38222
|
use Date::Format; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
require Logfile::Base; |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
use 5.008004; |
6
|
|
|
|
|
|
|
use strict; |
7
|
|
|
|
|
|
|
use warnings; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Logfile::Base); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub next { |
14
|
|
|
|
|
|
|
my $self = shift; |
15
|
|
|
|
|
|
|
my $fh = $self->{Fh}; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
my ( |
18
|
|
|
|
|
|
|
$line, $time, $elapsed, |
19
|
|
|
|
|
|
|
$remotehost, $code_status, $bytes, |
20
|
|
|
|
|
|
|
$method, $URL, $rfc931, |
21
|
|
|
|
|
|
|
$peerstatus_peerhost, $type, $smartfilter_category, |
22
|
|
|
|
|
|
|
$date |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
while ( $line = <$fh> ) { |
25
|
|
|
|
|
|
|
chomp($line); |
26
|
|
|
|
|
|
|
( |
27
|
|
|
|
|
|
|
$time, $elapsed, $remotehost, |
28
|
|
|
|
|
|
|
$code_status, $bytes, $method, |
29
|
|
|
|
|
|
|
$URL, $rfc931, $peerstatus_peerhost, |
30
|
|
|
|
|
|
|
$type, $smartfilter_category |
31
|
|
|
|
|
|
|
) |
32
|
|
|
|
|
|
|
= split( ' ', $line, 11 ); |
33
|
|
|
|
|
|
|
last if ($time); |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
return undef unless $time; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
#date formating e.g. 01/Nov/2004:18:13:34 |
39
|
|
|
|
|
|
|
$date = time2str( "%d/%b/%Y:%H:%M:%S", $time ); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Logfile::Base::Record->new( |
42
|
|
|
|
|
|
|
Host => $remotehost, |
43
|
|
|
|
|
|
|
Date => $date, |
44
|
|
|
|
|
|
|
URL => $URL, |
45
|
|
|
|
|
|
|
Bytes => $bytes, |
46
|
|
|
|
|
|
|
Elapsed => $elapsed, |
47
|
|
|
|
|
|
|
Code_Status => $code_status, |
48
|
|
|
|
|
|
|
Method => $method, |
49
|
|
|
|
|
|
|
RFC931 => $rfc931, |
50
|
|
|
|
|
|
|
Peerstatus_Peerhost => $peerstatus_peerhost, |
51
|
|
|
|
|
|
|
Type => $type, |
52
|
|
|
|
|
|
|
SmartFilter_Category => $smartfilter_category |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub norm { |
57
|
|
|
|
|
|
|
my ( $self, $key, $val ) = @_; |
58
|
|
|
|
|
|
|
$val; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
__END__ |