#!/usr/bin/perl -w $today2=`date`; if (!defined($ARGV[0])) { $today=`date +%d`; $log=1; } else { $today=$ARGV[0]; $log=0; } chomp $today; $old_host_name=""; open (INPUT_FILE,"/var/log/httpd/access_log"); open (OUTPUT_FILE,">>/home/eppstein/usage/hits.txt"); if ($log) { print OUTPUT_FILE substr($today2,0,10).":\n"; print substr($today2,0,10).":\n"; } while (defined ($input_line=)) { $date=substr($input_line,index($input_line,"[")+1,2); if ($date eq $today) { @args=split(/ /,$input_line); $host_name=$args[0]; if ($host_name ne $old_host_name) { print $host_name."\n"; if ($log) { print OUTPUT_FILE $host_name."\n"; } $old_host_name=$host_name; } } } if ($log) { print OUTPUT_FILE "\n"; } if ($old_host_name eq "" ) { print "No hits for ".`date`; } close (INPUT_FILE);