line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Regexp::Log::Helix; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
532
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
31
|
|
4
|
1
|
|
|
1
|
|
5
|
use base qw( Regexp::Log ); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
823
|
|
5
|
1
|
|
|
1
|
|
1380
|
use vars qw( $VERSION %DEFAULT %FORMAT %REGEXP ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
209
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
$VERSION = sprintf("%d.%02d", q$Revision: 1.4 $ =~ /(\d+)\.(\d+)/); |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Regexp::Log::Helix - A regular expression parser for Helix |
12
|
|
|
|
|
|
|
log format. |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $foo = Regexp::Log::Helix->new( |
17
|
|
|
|
|
|
|
format => ':style11_3', |
18
|
|
|
|
|
|
|
capture => [qw( ip date req )], |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
my $re = $foo->regexp; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=head1 DESCRIPTION |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
This module parses access logs created by Real's Helix 11. |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
For more information on how to use this module, please see Regexp::Log. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head1 ABSTRACT |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Regexp::Log::Helix enables simple parsing of log files created by Helix. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# default values |
35
|
|
|
|
|
|
|
%DEFAULT = ( |
36
|
|
|
|
|
|
|
format => (q(%ip %rfc %authuser %date ). |
37
|
|
|
|
|
|
|
q(%request %status %bytes ). |
38
|
|
|
|
|
|
|
q(%useragent %clientid %clientstats ). |
39
|
|
|
|
|
|
|
q(%filesize %filetime %conntime %resends %failedresends ). |
40
|
|
|
|
|
|
|
q(%streamcomp %starttime %serverip)), |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
capture => [qw( ip rfc authuser date |
43
|
|
|
|
|
|
|
request status bytes |
44
|
|
|
|
|
|
|
ua id stats |
45
|
|
|
|
|
|
|
filesize filetime conntime resends failedresends |
46
|
|
|
|
|
|
|
components startts serverip )] |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# predefined format strings |
50
|
|
|
|
|
|
|
%FORMAT = ( |
51
|
|
|
|
|
|
|
':default' => q(%ip %rfc %authuser %date %request %status %bytes %useragent %clientid %clientstats ). |
52
|
|
|
|
|
|
|
q(%filesize %filetime %conntime %resends %failedresends %streamcomp %starttime %serverip), |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
':style11_3' => q(%ip %rfc %authuser %date %request %status %bytes %useragent %clientid %clientstats ). |
55
|
|
|
|
|
|
|
q(%filesize %filetime %conntime %resends %failedresends %streamcomp %starttime %serverip), |
56
|
|
|
|
|
|
|
); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
# the regexps that match the various fields |
59
|
|
|
|
|
|
|
%REGEXP = ( '%ip' => '(?#=ip).*?(?#!ip)', |
60
|
|
|
|
|
|
|
'%rfc' => '(?#=rfc).*?(?#!rfc)', # rfc931 |
61
|
|
|
|
|
|
|
'%authuser' => '(?#=authuser).*?(?#!authuser)', # authuser |
62
|
|
|
|
|
|
|
'%date' => '(?#=date)\[(?#=ts)\d{2}/\w{3}/\d{4}(?::\d{2}){3} [-+]\d{4}(?#!ts)\](?#!date)\s?', |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
'%request' => '(?#=request)"(?#=req)(?#=req_method)\w+(?#!req_method) (?#=req_file)[^\s\?]+(?#!req_file)(?:\?(?#=req_query)\S+(?#!req_query))? (?#=req_protocol).*?(?#!req_protocol)(?#!req)"(?#!request)', |
65
|
|
|
|
|
|
|
'%status' => '(?#=status)\d+(?#!status)', |
66
|
|
|
|
|
|
|
'%bytes' => '(?#=bytes)-|\d+(?#!bytes)', # bytes |
67
|
|
|
|
|
|
|
'%useragent' => '(?#=useragent)\[(?#=ua).*?(?#!ua)\](?#!useragent)', |
68
|
|
|
|
|
|
|
'%clientid' => '(?#=clientid)\[(?#=id).*?(?#!id)\](?#!clientid)', |
69
|
|
|
|
|
|
|
'%clientstats' => '(?#=clientstats)\[(?#=stats).*?(?#!stats)\](?#!clientstats)', |
70
|
|
|
|
|
|
|
'%filesize' => '(?#=filesize)\d*?(?#!filesize)', |
71
|
|
|
|
|
|
|
'%filetime' => '(?#=filetime)\d*?(?#!filetime)', |
72
|
|
|
|
|
|
|
'%conntime' => '(?#=conntime)\d*?(?#!conntime)', |
73
|
|
|
|
|
|
|
'%resends' => '(?#=resends)\d*?(?#!resends)', |
74
|
|
|
|
|
|
|
'%failedresends' => '(?#=failedresends)\d*?(?#!failedresends)', |
75
|
|
|
|
|
|
|
'%streamcomp' => '(?#=streamcomp)\[(?#=components).*?(?#!components)\](?#!streamcomp)', |
76
|
|
|
|
|
|
|
'%starttime' => '(?#=starttime)\[(?#=startts)\d{2}/\w{3}/\d{4}(?::\d{2}){3}(?#!startts)\](?#!starttime)', |
77
|
|
|
|
|
|
|
'%serverip' => '(?#=serverip)\S+(?#!serverip)', |
78
|
|
|
|
|
|
|
); |
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |