diff options
Diffstat (limited to 'make_combined_log.pl')
-rwxr-xr-x | make_combined_log.pl | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/make_combined_log.pl b/make_combined_log.pl index d375f3a..009db42 100755 --- a/make_combined_log.pl +++ b/make_combined_log.pl | |||
@@ -1,6 +1,6 @@ | |||
1 | #!/usr/bin/perl | 1 | #!/usr/bin/perl |
2 | 2 | ||
3 | # $Id: make_combined_log.pl,v 1.1 2001/11/28 05:26:54 helios Exp $ | 3 | # $Id: make_combined_log.pl,v 1.2 2001/12/03 19:54:02 helios Exp $ |
4 | # | 4 | # |
5 | # make_combined_log.pl | 5 | # make_combined_log.pl |
6 | # | 6 | # |
@@ -45,7 +45,7 @@ $virthost = $ARGV[1]; | |||
45 | # | 45 | # |
46 | # Set up the proper variables to permit database access | 46 | # Set up the proper variables to permit database access |
47 | # | 47 | # |
48 | $serverName = "your.dbmachine.com"; | 48 | $serverName = "your.dbhost.com"; |
49 | $serverPort = "3306"; | 49 | $serverPort = "3306"; |
50 | $serverUser = "someuser"; | 50 | $serverUser = "someuser"; |
51 | $serverPass = "somepass"; | 51 | $serverPass = "somepass"; |
@@ -57,8 +57,6 @@ $serverDb = "apache"; | |||
57 | # | 57 | # |
58 | $st_tz = "-0800"; | 58 | $st_tz = "-0800"; |
59 | $dt_tz = "-0700"; | 59 | $dt_tz = "-0700"; |
60 | $type = "GET"; | ||
61 | $http = "HTTP/1.1"; | ||
62 | 60 | ||
63 | $now = time(); | 61 | $now = time(); |
64 | $start = $now - (86400 * $days); | 62 | $start = $now - (86400 * $days); |
@@ -71,7 +69,7 @@ if (not $dbh) { | |||
71 | die "Unable to connect to the database. Please check your connection variables. (Bad password? Incorrect perms?)"; | 69 | die "Unable to connect to the database. Please check your connection variables. (Bad password? Incorrect perms?)"; |
72 | } | 70 | } |
73 | 71 | ||
74 | $records = $dbh->prepare("select remote_host,remote_user,request_uri,request_duration,time_stamp,status,bytes_sent,referer,agent from $serverTbl where virtual_host='$virthost' and time_stamp >= $start"); | 72 | $records = $dbh->prepare("select remote_host,remote_user,request_uri,time_stamp,status,bytes_sent,referer,agent,request_method,request_protocol from $serverTbl where virtual_host='$virthost' and time_stamp >= $start"); |
75 | $records->execute; | 73 | $records->execute; |
76 | if (not $records) { | 74 | if (not $records) { |
77 | die "No such table or the select returned no records." | 75 | die "No such table or the select returned no records." |
@@ -94,7 +92,7 @@ while (@data = $records->fetchrow_array) { | |||
94 | $year=$year+1900; | 92 | $year=$year+1900; |
95 | 93 | ||
96 | # Create format for leading-zero formatting | 94 | # Create format for leading-zero formatting |
97 | if ($day < 10) { $day = "0$day"; } | 95 | if ($mday < 10) { $mday = "0$mday"; } |
98 | if ($month < 10) { $month = "0$month"; } | 96 | if ($month < 10) { $month = "0$month"; } |
99 | if ($hour < 10) { $hour = "0$hour"; } | 97 | if ($hour < 10) { $hour = "0$hour"; } |
100 | if ($min < 10) { $min = "0$min"; } | 98 | if ($min < 10) { $min = "0$min"; } |
@@ -123,7 +121,7 @@ while (@data = $records->fetchrow_array) { | |||
123 | } else { | 121 | } else { |
124 | print "$st_tz\] "; | 122 | print "$st_tz\] "; |
125 | } | 123 | } |
126 | print "\"$type $data[2] $http\" $data[5] $data[6] \"$data[7]\" \"$data[8]\"\n"; | 124 | print "\"$data[9] $data[2] $data[10]\" $data[5] $data[6] \"$data[7]\" \"$data[8]\"\n"; |
127 | } | 125 | } |
128 | 126 | ||
129 | # | 127 | # |