httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "S.A. Birl" <sbirl+Apache-L...@temple.edu>
Subject [users@httpd] creating own program for piped logs
Date Mon, 28 Apr 2008 19:42:11 GMT
Hello all!

(Please let know if Im re-inventing the wheel here ...)

Im the beginning stages of a PERL script to parse incoming requests by
the first directory name (for tracking individual website stats).

(ie:
0.0.0.0 - - [28/Apr/2008:15:31:36 -0400] "GET /stats/blah/blah HTTP/1.0" 200 13127
     would log to a file called "stats" while
0.0.0.0 - - [28/Apr/2008:15:31:36 -0400] "GET /photo/blah/blah HTTP/1.0" 200 15093
     would log to a file called "photo"
etc)

In the virtual host I have the pipe set up:
    CustomLog "|/usr/local/apache/bin/LogIndividualWebsites.pl" common

The PERL program executes without failure from the commandline (and
writes my input followed by ^D), but does not write anything when
invoked (as root) from the pipe.

Not looking for PERL help per se, but more for help on why the pipe is
failing.  Script is chmod 0700   root:root.

Apache is error logging with debug, but there's nothing to related the
PERL program in there.


Thanks
 S.A. Birl

==========
#!/usr/bin/perl -T
#
# c: 2008-Apr-28  S.A. Birl
# m:
#
# THIS PROGRAM IS EXECUTED BY ROOT
#
# For every incoming request to Apache, this program will analyze the
# line and log it to the appropriate file for later parsing.
#
# This program assumes the STDIN is standard Apache "common" logging.
#

use strict;
use warnings;

my $DIRECTORY="/usr/local/apache/logs/websites"; 	# Where we will log
my $Website;						# Extracted from the input
my $DebugLog="$DIRECTORY/___DebugLog___"; 		# debugging purposes
my $WebsiteLog;						# $DIRECTORY/$Website

open(DEBUG, ">>$DebugLog") or die;

#print "#";
print DEBUG <>;


#EOF
==========





Please do not CC me responses to my own posts.
I'll read the responses on the list.

Archives   http://mail-archives.apache.org/mod_mbox/httpd-users/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message