line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- Mode: Perl -*- |
2
|
|
|
|
|
|
|
# Wn.pm -- |
3
|
|
|
|
|
|
|
# ITIID : $ITI$ $Header $__Header$ |
4
|
|
|
|
|
|
|
# Author : Ulrich Pfeifer |
5
|
|
|
|
|
|
|
# Created On : Wed May 22 13:17:07 1996 |
6
|
|
|
|
|
|
|
# Last Modified By: Ulrich Pfeifer |
7
|
|
|
|
|
|
|
# Last Modified On: Fri May 29 15:29:14 1998 |
8
|
|
|
|
|
|
|
# Language : CPerl |
9
|
|
|
|
|
|
|
# Update Count : 14 |
10
|
|
|
|
|
|
|
# Status : Unknown, Use with caution! |
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
# (C) Copyright 1996, Universität Dortmund, all rights reserved. |
13
|
|
|
|
|
|
|
# |
14
|
|
|
|
|
|
|
# $Locker: pfeifer $ |
15
|
|
|
|
|
|
|
# $Log: Wn.pm,v $ |
16
|
|
|
|
|
|
|
# Revision 0.1.1.1 1996/06/04 14:35:31 pfeifer |
17
|
|
|
|
|
|
|
# patch13: Support for the WN http server. |
18
|
|
|
|
|
|
|
# |
19
|
|
|
|
|
|
|
# Revision 1.1 1996/05/23 13:46:05 pfeifer |
20
|
|
|
|
|
|
|
# Initial revision |
21
|
|
|
|
|
|
|
# |
22
|
|
|
|
|
|
|
# |
23
|
|
|
|
|
|
|
package Logfile::Wn; |
24
|
|
|
|
|
|
|
require Logfile::Base; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
@ISA = qw ( Logfile::Base ) ; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub next { |
29
|
127
|
|
|
127
|
0
|
159
|
my $self = shift; |
30
|
127
|
|
|
|
|
258
|
my $fh = $self->{Fh}; |
31
|
127
|
|
|
|
|
310
|
my ($host, $bytes, $error, $code, $dummy, $date, $request, $client, $referer) |
32
|
|
|
|
|
|
|
= ('') x 9; |
33
|
127
|
|
|
|
|
215
|
*S = $fh; |
34
|
127
|
|
|
|
|
134
|
while (1) { |
35
|
130
|
|
|
|
|
729
|
my $line = ; |
36
|
130
|
100
|
|
|
|
243
|
return undef unless defined $line; |
37
|
129
|
100
|
|
|
|
600
|
if ($line =~ s/(\S+)\s+//) { |
38
|
128
|
|
|
|
|
354
|
$host = $1; |
39
|
|
|
|
|
|
|
} else { |
40
|
1
|
|
|
|
|
2
|
next; |
41
|
|
|
|
|
|
|
} |
42
|
128
|
50
|
|
|
|
568
|
unless ($line =~ s/(\S+)\s+(\S+)\s+//) { |
43
|
0
|
|
|
|
|
0
|
next; |
44
|
|
|
|
|
|
|
} |
45
|
128
|
100
|
|
|
|
598
|
if ($line =~ s/\[(.*?)\]\s+//) { |
46
|
126
|
|
|
|
|
245
|
$date = $1; |
47
|
|
|
|
|
|
|
} else { |
48
|
2
|
|
|
|
|
3
|
next; |
49
|
|
|
|
|
|
|
} |
50
|
126
|
50
|
|
|
|
552
|
if ($line =~ s/\"(.*?)\"\s+//) { |
51
|
126
|
|
|
|
|
220
|
$request = $1; |
52
|
126
|
|
|
|
|
407
|
$request =~ s/^(GET|HEAD) //; |
53
|
126
|
|
|
|
|
449
|
$request =~ s: HTTP/1.0$::; |
54
|
|
|
|
|
|
|
} else { |
55
|
|
|
|
|
|
|
next |
56
|
0
|
|
|
|
|
0
|
} |
57
|
126
|
100
|
|
|
|
1964
|
if ($line =~ s/(\S+)\s+(\d+)\s+//) { |
58
|
36
|
|
|
|
|
52
|
$code = $1; |
59
|
36
|
|
|
|
|
53
|
$bytes = $2; |
60
|
|
|
|
|
|
|
} |
61
|
126
|
50
|
|
|
|
569
|
if ($line =~ s/\<(.*?)\>\s+//) { |
62
|
126
|
|
|
|
|
237
|
$error = $1; |
63
|
|
|
|
|
|
|
} else { |
64
|
|
|
|
|
|
|
next |
65
|
0
|
|
|
|
|
0
|
} |
66
|
126
|
50
|
|
|
|
524
|
if ($line =~ s/\<(.*?)\>\s+//) { |
67
|
126
|
|
|
|
|
255
|
$client = $1; |
68
|
|
|
|
|
|
|
} else { |
69
|
|
|
|
|
|
|
next |
70
|
0
|
|
|
|
|
0
|
} |
71
|
126
|
50
|
|
|
|
449
|
if ($line =~ s/\<(.*?)\>\s+//) { |
72
|
126
|
|
|
|
|
209
|
$referer = $1; |
73
|
|
|
|
|
|
|
} else { |
74
|
|
|
|
|
|
|
next |
75
|
0
|
|
|
|
|
0
|
} |
76
|
126
|
|
100
|
|
|
953
|
return(Logfile::Base::Record->new(Host => $host, |
77
|
|
|
|
|
|
|
Date => $date, |
78
|
|
|
|
|
|
|
Error => $error, |
79
|
|
|
|
|
|
|
Client => $client, |
80
|
|
|
|
|
|
|
Referer => $referer, |
81
|
|
|
|
|
|
|
File => $request, |
82
|
|
|
|
|
|
|
Bytes => $bytes||0, |
83
|
|
|
|
|
|
|
) |
84
|
|
|
|
|
|
|
); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub norm { |
89
|
794
|
|
|
794
|
0
|
1138
|
my ($self, $key, $val) = @_; |
90
|
|
|
|
|
|
|
|
91
|
794
|
100
|
100
|
|
|
2997
|
if ($key eq File or $key eq Referer) { |
|
|
50
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
92
|
372
|
|
|
|
|
564
|
$val =~ s/\?.*//; # remove that !!! |
93
|
372
|
|
|
|
|
463
|
$val =~ s/GET //; |
94
|
372
|
100
|
|
|
|
616
|
$val = '/' unless $val; |
95
|
372
|
|
|
|
|
881
|
$val =~ s/\.\w+$//; |
96
|
372
|
|
|
|
|
500
|
$val =~ s!%([\da-f][\da-f])!chr(hex($1))!eig; |
|
0
|
|
|
|
|
0
|
|
97
|
372
|
|
|
|
|
581
|
$val =~ s!~(\w+)/.*!~$1!; |
98
|
|
|
|
|
|
|
# proxy |
99
|
372
|
|
|
|
|
520
|
$val =~ s!^((http|ftp|wais)://[^/]+)/.*!$1!; |
100
|
372
|
|
|
|
|
1390
|
$val; |
101
|
|
|
|
|
|
|
} elsif ($key eq Bytes) { |
102
|
0
|
|
|
|
|
0
|
$val =~ s/\D.*//; |
103
|
|
|
|
|
|
|
} elsif ($key eq Error) { |
104
|
164
|
|
|
|
|
653
|
$val =~ s:^\s*\(\d+/\d+\)\s+::; |
105
|
164
|
|
|
|
|
324
|
$val = substr($val,0,$Logfile::MAXWIDTH); |
106
|
164
|
|
|
|
|
694
|
$val; |
107
|
|
|
|
|
|
|
} else { |
108
|
258
|
|
|
|
|
738
|
$val; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
1; |