line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- Mode: Perl -*- |
2
|
|
|
|
|
|
|
# SFgate.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: Fri Jun 12 10:09:26 1998 |
8
|
|
|
|
|
|
|
# Language : Perl |
9
|
|
|
|
|
|
|
# Update Count : 35 |
10
|
|
|
|
|
|
|
# Status : Unknown, Use with caution! |
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
# (C) Copyright 1996, Universität Dortmund, all rights reserved. |
13
|
|
|
|
|
|
|
# |
14
|
|
|
|
|
|
|
# $Locker: pfeifer $ |
15
|
|
|
|
|
|
|
# $Log: SFgate.pm,v $ |
16
|
|
|
|
|
|
|
# Revision 0.1.1.1 1996/04/01 09:36:21 pfeifer |
17
|
|
|
|
|
|
|
# patch8: New. Only extracts databases currently. |
18
|
|
|
|
|
|
|
# |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
package Logfile::SFgate; |
21
|
|
|
|
|
|
|
require Logfile::Base; |
22
|
1
|
|
|
1
|
|
918
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
46
|
|
23
|
1
|
|
|
1
|
|
5
|
use vars qw(@ISA); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
844
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
@ISA = qw ( Logfile::Base ) ; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub next { |
29
|
1
|
|
|
1
|
0
|
3
|
my $self = shift; |
30
|
1
|
|
|
|
|
2
|
my $fh = $self->{Fh}; |
31
|
1
|
|
|
|
|
2
|
my ($date, $Hour, @Databases, $Queries); |
32
|
1
|
50
|
|
|
|
5
|
unless (@Databases) { |
33
|
1
|
|
|
|
|
7
|
*S = $fh; |
34
|
1
|
|
|
|
|
15
|
LINE: while (1) { |
35
|
1
|
50
|
|
|
|
5
|
return undef if (eof(S)); |
36
|
1
|
|
|
|
|
10
|
my $line = ; |
37
|
1
|
|
|
|
|
4
|
$date = substr($line,0,14); |
38
|
1
|
|
|
|
|
8
|
($Hour) = ($line =~ /\s(\d\d):\d\d/); |
39
|
1
|
50
|
|
|
|
5
|
next LINE if length($line) < 24; |
40
|
1
|
|
|
|
|
6
|
my ($pid, $host, $request) = split ' ', substr($line,24); |
41
|
1
|
|
|
|
|
2
|
my $field; |
42
|
1
|
|
|
|
|
5
|
for $field (split /\&/, $request) { |
43
|
5
|
|
|
|
|
33
|
my ($field, $value) = split /=/, $field; |
44
|
5
|
100
|
|
|
|
12
|
if ($field eq 'database') { |
45
|
1
|
|
|
|
|
3
|
push (@Databases, $value); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
1
|
50
|
|
|
|
9
|
last LINE if @Databases; |
49
|
|
|
|
|
|
|
} |
50
|
1
|
|
|
|
|
4
|
$Queries = 1/@Databases; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
} |
53
|
1
|
|
|
|
|
10
|
Logfile::Base::Record->new(Database => shift @Databases, |
54
|
|
|
|
|
|
|
Queries => $Queries, |
55
|
|
|
|
|
|
|
Date => $date, |
56
|
|
|
|
|
|
|
Hour => $Hour, |
57
|
|
|
|
|
|
|
); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub norm { |
61
|
0
|
|
|
0
|
0
|
|
my ($self, $key, $val) = @_; |
62
|
|
|
|
|
|
|
|
63
|
0
|
0
|
|
|
|
|
if ($key eq 'Database') { |
64
|
0
|
|
|
|
|
|
(split '/', $val)[-1]; |
65
|
|
|
|
|
|
|
} else { |
66
|
0
|
|
|
|
|
|
$val; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
1; |