logger
containing
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" -->and 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.