RE: Top sites accessed

From: Williams Jon <WilliamsJon@dont-contact.us>
Date: Tue, 6 Jul 1999 10:18:54 -0500

If you run this script with the 3-letter abbreviation for the month as the
only commandline argument, it should do what you want.

Jon

#!/usr/local/bin/perl
@months =
('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
open(INFILE,"access.log") || die "Can't open access.log for read: $!\n";
while(<INFILE>)
        {
                @parts = split(/\s+/,$_);
                next unless ( $months[(localtime($parts[0]))[4]] eq $ARGV[0]
);
                $urls{$parts[6]}++;
        } #end of while()
close(INFILE) || die "Can't close access.log: $!\n";
foreach $url (sort {$urls{$b} <=> $urls{$a}} keys(%urls))
        {
                last if (++$cnt > 50);
                print "$urls{$url} $url\n";
        } #end of foreach()

> -----Original Message-----
> From: Joel Taqueban [SMTP:jtaqueba@mnl-hub.dhl.com]
> Sent: Monday, July 05, 1999 1:54 AM
> To: squid-users@ircache.net
> Subject: Top sites accessed
>
> How do I determine the top 50 sites accessed for a month from my
> access.log
> file?
>
> Joel
Received on Tue Jul 06 1999 - 09:15:10 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:47:18 MST