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
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
27
|
1
|
|
|
|
|
2
|
my $fh = $self->{Fh}; |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
4
|
*S = $fh; |
30
|
1
|
|
|
|
|
4
|
my $line = ; |
31
|
1
|
|
|
|
|
4
|
my ($date, $req, $host, $referer) = ('') x 4; |
32
|
|
|
|
|
|
|
|
33
|
1
|
50
|
|
|
|
13
|
$date = $1 if ($line =~ s!^\[([^\]]+)\]\s*!!); |
34
|
1
|
50
|
|
|
|
5
|
$req = $1 if ($line =~ s!, req: (.*) HTTP/1.0!!); |
35
|
1
|
50
|
|
|
|
4
|
($host, $referer) = ($1, $3) if |
36
|
|
|
|
|
|
|
($line =~ s!\[host: (\S*)( referer: (\S*))?\]!!); |
37
|
1
|
|
|
|
|
2
|
$line =~ s!\[OK-GATEWAY\]!!; |
38
|
1
|
|
|
|
|
2
|
$line =~ s!\[OK\]!!; |
39
|
1
|
|
|
|
|
2
|
$line =~ s!^\s+!!; |
40
|
1
|
|
|
|
|
6
|
$line =~ s!\s+$!!; |
41
|
1
|
|
|
|
|
10
|
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
|
0
|
|
|
0
|
0
|
|
my ($self, $key, $val) = @_; |
51
|
|
|
|
|
|
|
|
52
|
0
|
0
|
0
|
|
|
|
if ($key eq File or $key eq Referer) { |
|
|
0
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
$val =~ s/\?.*//; # remove that !!! |
54
|
0
|
|
|
|
|
|
$val =~ s/GET //; |
55
|
0
|
0
|
|
|
|
|
$val = '/' unless $val; |
56
|
0
|
|
|
|
|
|
$val =~ s/\.\w+$//; |
57
|
0
|
|
|
|
|
|
$val =~ s!%([\da-f][\da-f])!chr(hex($1))!eig; |
|
0
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
$val =~ s!~(\w+)/.*!~$1!; |
59
|
|
|
|
|
|
|
# proxy |
60
|
0
|
|
|
|
|
|
$val =~ s!^((http|ftp|wais)://[^/]+)/.*!$1!; |
61
|
|
|
|
|
|
|
# specific |
62
|
0
|
|
|
|
|
|
$val =~ s!icons/.*!icons/*!; |
63
|
0
|
|
|
|
|
|
$val =~ s!freeWAIS-sf/.*!freeWAIS-sf/*!; |
64
|
0
|
|
|
|
|
|
$val; |
65
|
|
|
|
|
|
|
} elsif ($key eq Bytes) { |
66
|
0
|
|
|
|
|
|
$val =~ s/\D.*//; |
67
|
|
|
|
|
|
|
} else { |
68
|
0
|
|
|
|
|
|
$val; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
1; |