line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- Mode: Perl -*- |
2
|
|
|
|
|
|
|
# CernErr.pm -- |
3
|
|
|
|
|
|
|
# ITIID : $ITI$ $Header $__Header$ |
4
|
|
|
|
|
|
|
# Author : Ulrich Pfeifer |
5
|
|
|
|
|
|
|
# Created On : Mon Mar 25 09:59:37 1996 |
6
|
|
|
|
|
|
|
# Last Modified By: Ulrich Pfeifer |
7
|
|
|
|
|
|
|
# Last Modified On: Tue Apr 2 09:55:07 1996 |
8
|
|
|
|
|
|
|
# Language : Perl |
9
|
|
|
|
|
|
|
# Update Count : 29 |
10
|
|
|
|
|
|
|
# Status : Unknown, Use with caution! |
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
# (C) Copyright 1996, Universität Dortmund, all rights reserved. |
13
|
|
|
|
|
|
|
# |
14
|
|
|
|
|
|
|
# $Locker: pfeifer $ |
15
|
|
|
|
|
|
|
# $Log: CernErr.pm,v $ |
16
|
|
|
|
|
|
|
# Revision 0.1.1.1 1996/04/02 08:27:31 pfeifer |
17
|
|
|
|
|
|
|
# patch9: Added cern error logging. |
18
|
|
|
|
|
|
|
# |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
package Logfile::CernErr; |
21
|
|
|
|
|
|
|
require Logfile::Base; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
@ISA = qw ( Logfile::Base ) ; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub next { |
26
|
111
|
|
|
111
|
0
|
147
|
my $self = shift; |
27
|
111
|
|
|
|
|
252
|
my $fh = $self->{Fh}; |
28
|
|
|
|
|
|
|
|
29
|
111
|
|
|
|
|
195
|
*S = $fh; |
30
|
111
|
|
|
|
|
584
|
my $line = ; |
31
|
111
|
|
|
|
|
233
|
my ($date, $req, $host, $referer) = ('') x 4; |
32
|
|
|
|
|
|
|
|
33
|
111
|
50
|
|
|
|
834
|
$date = $1 if ($line =~ s!^\[([^\]]+)\]\s*!!); |
34
|
111
|
100
|
|
|
|
678
|
$req = $1 if ($line =~ s!, req: (.*) HTTP/1.0!!); |
35
|
111
|
100
|
|
|
|
739
|
($host, $referer) = ($1, $3) if |
36
|
|
|
|
|
|
|
($line =~ s!\[host: (\S*)( referer: (\S*))?\]!!); |
37
|
111
|
|
|
|
|
198
|
$line =~ s!\[OK-GATEWAY\]!!; |
38
|
111
|
|
|
|
|
136
|
$line =~ s!\[OK\]!!; |
39
|
111
|
|
|
|
|
218
|
$line =~ s!^\s+!!; |
40
|
111
|
|
|
|
|
326
|
$line =~ s!\s+$!!; |
41
|
111
|
|
|
|
|
589
|
Logfile::Base::Record->new(Host => $host, |
42
|
|
|
|
|
|
|
Date => $date, |
43
|
|
|
|
|
|
|
Error => $line, |
44
|
|
|
|
|
|
|
Referer => $referer, |
45
|
|
|
|
|
|
|
File => $req, |
46
|
|
|
|
|
|
|
); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub norm { |
50
|
555
|
|
|
555
|
0
|
786
|
my ($self, $key, $val) = @_; |
51
|
|
|
|
|
|
|
|
52
|
555
|
100
|
66
|
|
|
2100
|
if ($key eq File or $key eq Referer) { |
|
|
50
|
|
|
|
|
|
53
|
222
|
|
|
|
|
356
|
$val =~ s/\?.*//; # remove that !!! |
54
|
222
|
|
|
|
|
580
|
$val =~ s/GET //; |
55
|
222
|
100
|
|
|
|
422
|
$val = '/' unless $val; |
56
|
222
|
|
|
|
|
600
|
$val =~ s/\.\w+$//; |
57
|
222
|
|
|
|
|
267
|
$val =~ s!%([\da-f][\da-f])!chr(hex($1))!eig; |
|
0
|
|
|
|
|
0
|
|
58
|
222
|
|
|
|
|
298
|
$val =~ s!~(\w+)/.*!~$1!; |
59
|
|
|
|
|
|
|
# proxy |
60
|
222
|
|
|
|
|
247
|
$val =~ s!^((http|ftp|wais)://[^/]+)/.*!$1!; |
61
|
|
|
|
|
|
|
# specific |
62
|
222
|
|
|
|
|
244
|
$val =~ s!icons/.*!icons/*!; |
63
|
222
|
|
|
|
|
383
|
$val =~ s!freeWAIS-sf/.*!freeWAIS-sf/*!; |
64
|
222
|
|
|
|
|
798
|
$val; |
65
|
|
|
|
|
|
|
} elsif ($key eq Bytes) { |
66
|
0
|
|
|
|
|
0
|
$val =~ s/\D.*//; |
67
|
|
|
|
|
|
|
} else { |
68
|
333
|
|
|
|
|
1210
|
$val; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
1; |