#! /opt/bin/perl # ________________________________________________________________ # /\ /\ The Web Developer's Virtual Library # -{-<*>-}- World-Wide Web # __\/_\/_________________________________________________________ # Author : Lucy Richmond # Purpose : To read the access log and create a file of referring # pages and their number of referrals. # Usage : ref_cnt.pl # Comment : The input file is access_log and the output file is # rcur.log. The output file is formatted like the one # created by log.pl except the URL is the referal page # rather than the called URL. This output file must # currently be manually edited to remove the double quotes # around the referral URL and extraneous entries. # 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. # ________________________________________________________________ open (IN, "rcur.log")||die$!; while () { s/"//g; ($who, $j, $j, $datime, $TZ, $method, $URL, $protoc, $status, $bytes, $refer, $browser) = split ; # exclude referrals from within our own site or from someome's hard disk next if ($refer =~ /^\"file/i); next if ($refer =~ /wdvl.internet.com/i); next if ($refer =~ /stars.com/i); next if ($refer =~ /wdvl.com/i); next if ($refer =~ /dev-wdvl.iworld.com/i); next unless ($refer =~ /^http:/); $file{$refer}++; } foreach (keys %file) { $count = $file{$_}; print OUT "$count $_\n" if $count > 5; }