[ic] Writing Apache Style Referer Log From Interchange
Shawn Mathews
shawn at stuckinrealtime.us
Wed Apr 28 00:02:51 EDT 2004
Ok, I know this is probably stupid, and apache is already creating logs,
but........
I need a single log file for my catalogs, which have a different secure
and unsecure webserver.
So far I've got this in my catalog.cfg which can generate an apache
style log line except for the size of the content being returned.
I'm planning on using this in an AutoEnd script. Which makes the
question......
How do I get the size of the content current in the Interchange page buffer?
Sub <<EOR
sub e5_apachelog {
my $h = ::http();
my $ENV = $h->{env};
my $fakeurl = $Vend::Cfg->{'VendURL'};
my $host = $ENV->{'REMOTE_ADDR'};
my $method = $ENV->{'REQUEST_METHOD'};
my $protocol = $ENV->{'SERVER_PROTOCOL'};
my $referer = $ENV->{'HTTP_REFERER'} || '-';
my $agent = $ENV->{'HTTP_USER_AGENT'} || '-';
my $status = '200'; # Always Status 200
my $page = '/'.$Global::Variable->{'MV_PAGE'}.'.html';
$page .= $ENV->{'QUERY_STRING'} if $ENV->{'QUERY_STRING'};
my $timezone = 'EST';
my @MonthLib =
("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
my
($nowsec,$nowmin,$nowhour,$nowday,$nowmonth,$nowyear,$nowwday,$nowyday)
= localtime(time());
my $time = sprintf("[%02d/%s/%04d:%02d:%02d:%02d
$timezone]",$nowday,$MonthLib[$nowmonth],$nowyear+1900,$nowhour,$nowmin,$nowsec);
my $logline = sprintf(q{%s - - %s "GET %s %s" %s - "%s" "%s"}, $host,
$time, $page, $protocol, $status, $referer, $agent);
return $logline;
}
EOR
Thanks,
Shawn Mathews
More information about the interchange-users
mailing list