One way to set up page logging (one way we do it at the Geometry Center) will be described here. You will likely need some extra information or assistance to make this approach work at your site.
In most cases, this form of logging will involve a three-step process:
Make an executable perl script
called logger
(and use chmod +x filename
, if needed).
It should contain the following code:
#! /usr/local/bin/perl $machine = $ENV{REMOTE_HOST}; $date = $ENV{DATE_LOCAL}; $agent = $ENV{HTTP_USER_AGENT}; $referer = $ENV{HTTP_REFERER}; $referer = "*unknown*" if ($referer eq ""); $month{'Jan'} = 1; $month{'Feb'} = 2; $month{'Mar'} = 3; $month{'Apr'} = 4; $month{'May'} = 5; $month{'Jun'} = 6; $month{'Jul'} = 7; $month{'Aug'} = 8; $month{'Sep'} = 9; $month{'Oct'} = 10; $month{'Nov'} = 11; $month{'Dec'} = 12; ($d,$m,$y,$t) = ($date =~ m/(\d+)-([^-]+)-(\d+)\s+(\d\d:\d\d:\d\d)/); $date = sprintf("%02d-%02d-%02d",$y,$month{$m},$d)." ".$t; print($date," ",$machine," [",$referer,"] [",$agent,"]\n");
Insert a line at the top of your HTML file like the following:
<!--#exec cmd="./logger >> usage.log" -->
Finally, make an .htaccess
file starting with the lines
Options Includes AddType text/x-server-parsed-html filenamewhere
filename
is the name of the
.html
file that you want to log.