perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ryan Parr" <>
Subject Custom Logging and User Tracking
Date Wed, 13 Feb 2002 09:19:08 GMT
I'm trying to setup some custom logging including the whole User/Session tracking thing. The
problem that I'm encountering is how to log for the page that was requested and ignore all
the additional files that may be included in the page. I.e. graphics. Without trying to maintain
session uniqueness by comparing mod_uniqueid values.

return DECLINED unless($r->is_main()); does nothing
return DECLINED unless($r->is_initial_req()); does nothing

PerlFixupHandler logs every included file (is this what a subrequest is?)
PerlLogHandler logs every included file
PerlHandler only logs the initial request, but only logs for the / URI request. No other URI's
are logged.

my $code = <<EO_CODE_SAMPLE; 
sub handler {
 my $r = shift;

 open TRACK, ">>/usr/local/www/usertracker.txt" or die "Couldn't open log: $!";
 print TRACK join("\t",($r->hostname,$r->uri,scalar(localtime),$r->connection->remote_ip,$r->connection->hostname
|| '-' ,$r->header_in('Referer') || '-',$r->header_in('User-agent'))),"\n";
 close TRACK;
 return DECLINED;

View raw message