1 |
robbat2 10/10/03 19:18:46 |
2 |
|
3 |
Modified: parsePhpbbLog.pl |
4 |
Log: |
5 |
Fixup whitespace issues, and recognize invalid referrer strings. |
6 |
|
7 |
Revision Changes Path |
8 |
1.4 forums/scripts/parsePhpbbLog.pl |
9 |
|
10 |
file : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/scripts/parsePhpbbLog.pl?rev=1.4&view=markup |
11 |
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/scripts/parsePhpbbLog.pl?rev=1.4&content-type=text/plain |
12 |
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-projects/forums/scripts/parsePhpbbLog.pl?r1=1.3&r2=1.4 |
13 |
|
14 |
Index: parsePhpbbLog.pl |
15 |
=================================================================== |
16 |
RCS file: /var/cvsroot/gentoo-projects/forums/scripts/parsePhpbbLog.pl,v |
17 |
retrieving revision 1.3 |
18 |
retrieving revision 1.4 |
19 |
diff -p -w -b -B -u -u -r1.3 -r1.4 |
20 |
--- parsePhpbbLog.pl 26 Sep 2010 18:44:23 -0000 1.3 |
21 |
+++ parsePhpbbLog.pl 3 Oct 2010 19:18:46 -0000 1.4 |
22 |
@@ -41,7 +41,8 @@ while(my $rawline = <>) { |
23 |
chomp $rawline; |
24 |
|
25 |
# Chomp the syslog header |
26 |
- my ($syslog_header, $syslog_data) = $rawline =~ m/^(... \d\d \d\d:\d\d:\d\d \w+ \w+\[\d+\]: )(.*)/; |
27 |
+ my ($syslog_header, $syslog_data) = $rawline =~ m/^(... [\d ]\d \d\d:\d\d:\d\d \w+ \w+\[\d+\]:\s+)(.*)/; |
28 |
+ $syslog_data =~ s/^\s*|\s*$//g; |
29 |
|
30 |
# Did this actually come from phpbb? We don't give a damn about the rest |
31 |
if($syslog_header =~ /phpbb/) { |
32 |
@@ -49,7 +50,8 @@ while(my $rawline = <>) { |
33 |
# 0 1 2 3 4 5 6 7 8 9 |
34 |
# The weird regex for $req and $ref are due to some weird clients that are |
35 |
# sending " and spaces in them. |
36 |
- my @phpbb_logentry = $syslog_data =~ m/^([SE]) ([\d\w]*) ([\d.]+) ([-\w\d.]+) ([-\w\d]+|-) (\[\d\d\/\w\w\w\/\d{4}(?::\d{1,2}){3}\.\d+ \+\d{4}\]) ("\w+ .* HTTP\/[\d\.]+") (\d+|-) ("\w+:\/+.*"|"-") ("+[^"]+"+)/; |
37 |
+ #my @phpbb_logentry = $syslog_data =~ m/^\s*([SE])\s*([\d\w]*)\s*([\d.]+)\s*([-\w\d.]+)\s*([-\w\d]+|-)\s*(\[\d\d\/\w\w\w\/\d{4}(?::\d{1,2}){3}\.\d+ \+\d{4}\])\s*("\w+ .* HTTP\/[\d\.]+") (\d+|-)\s*("\w+:\/+.*"|"-")\s*("+[^"]+"+)$/; |
38 |
+ my @phpbb_logentry = $syslog_data =~ m/^\s*([SE])\s*([\d\w]*)\s*([\d.]+)\s*([-\w\d.]+)\s*([-\w\d]+|-)\s*(\[\d\d\/\w\w\w\/\d{4}(?::\d{1,2}){3}\.\d+ \+\d{4}\])\s*("\w+ .* HTTP\/[\d\.]+")\s*(\d+|-)\s*("\w+:\/+.*"|"-"|"[^"]+")\s*("+[^"]+"+)$/; |
39 |
#print "=S=\n".Dumper(@phpbb_logentry)."=E=\n"; |
40 |
|
41 |
# We have a bug in the code somewhere that is dropping the id... |
42 |
@@ -84,12 +86,12 @@ while(my $rawline = <>) { |
43 |
$stat_end++; |
44 |
} else { |
45 |
$stat_syslog_phpbbtype++; |
46 |
- printf("SYSLOG:UNKNWON-PHPBB-ENTRY-TYPE:%d type=%s %s",$lineno, $phpbb_logentry[0], $syslog_data); |
47 |
+ printf("SYSLOG:UNKNOWN-PHPBB-ENTRY-TYPE:%d type=%s line=%s\n",$lineno, $phpbb_logentry[0], $syslog_data); |
48 |
} |
49 |
|
50 |
} else { |
51 |
$stat_syslog_nonphpbb++; |
52 |
- printf("SYSLOG:NON-PHPBB:%d %s",$lineno,$rawline); |
53 |
+ printf("SYSLOG:NON-PHPBB:%d %s\n",$lineno,$rawline); |
54 |
} |
55 |
$lineno++; |
56 |
} |