#! /opt/bin/perl # ________________________________________________________________ # /\ /\ The Web Developer's Virtual Library # -{-<*>-}- World-Wide Web # __\/_\/_________________________________________________________ # Author : Lucy Richmond # Purpose : To read the access log and create an output file # of site web pages and their number of successfull page views. # The output file is used to create the Top 100. # Usage : log.pl fn # where fn is the name of the output file, fn.log # Comment : Because this is run against a daily log, only URLs with more than # 10 page views are included in the output file (specified in the # print command near the end of the program. # Disclaimer: This software is provided freely on the understanding # that the Author will not be held responsible for any # problems arising from it's use, and that there is no support. # ________________________________________________________________ $tothits = 0; $log = $ARGV[0]; open (IN, "access_log")||die$!; open (OUT, ">$log.log")||die$!; while () { /"\S+ (\S+)/; # /access to (\S+)/; # Error log next if / 404 /; $_ = $1; # If the file name ends with a slash, add 'index.html' to the end s/^$/\/index.html/; s/\/$/\/index.html/; # There are many old links to Vlib/Providers/Images_and_Icons which go to Multimedia now s/\/Vlib\/Providers\/Images/\/Vlib\/Multimedia\/Images/; next if /Images_and_Icons.html\/index.html/; next unless /\.html$/ or /\.wrl$/; next if /\/menubar.\.html/; $tothits++; s/^\/\//\//; $file{$_}++; } foreach (keys %file) { $count = $file{$_}; print OUT "$count $_\n" if $count > 10; } print "total hits $tothits\n";