Web Access-Log Analysis

Web Access Logs Analysis Examples

Here's how to do simple log analysis via the myhits program.

Use a telnet program to log into your DCN account. If you're using the Lynx shell, choose the "Unix Prompt" menu option. You'll see a UNIX command-line prompt that will look something like:

msmosaic@wheel ~ > 
Your login name will appear in place of "msmosaic".

At the prompt type this line (then press the Enter key):

myhits

You should immediately see the response:

Reading access log: /usr/local/etc/httpd/logs/access_log...
And, after some time,
Writing results.
Done.
and the UNIX prompt. Congratulations, you've just generated a log analysis. Now, crank up your web browser and ask for the URL: http://www.dcn.davis.ca.us/~loginid/access.html, replacing "loginid" with your DCN login ID. You should see a hit analysis for the current week.

Obtaining an analysis for a prior week

The simple example just looked at the current log file. There are also log files for previous weeks available. To list them, type:
myhits -m
and press the Enter key. The response will look something like:
960428.access_log
960505.access_log
960512.access_log
960519.access_log
access_log
Each log is named in YRMODY format for the day after its last date (the day it was rotated). You may analyze one of these files with a command like:
myhits -l 960519.access_log
(NOTE: that's the letter "l", not the digit "1") The "-l ..." addition to the command line tells myhits to look at a particular log file instead of the current one.

Popular options

myhits has many options for log file analysis. You may see a list of the options with the command:
myhits -h
A popular set of options asks for a breadown of URLs requested and of requestor domains:
myhits -ur
We can combine that with a request to analyze an old log with a command like:
myhits -ur -l 960519.access_log

Option list

Here's a list of the myhits options available at this writing:
usage: myhits [options]
Generates an HTML log file analysis.
options:
   -h             Print this help;
   -s text        Include only URLs containing "text"
                   (default is /~msmosaic/);
   -t text        Include only requesting hosts containing "text"
   -u             Include URL breakdown;
   -r             Include requestor breakdown;
   -n             Use Netscape graphics;
   -l logfile     Read log file "logfile" (default is access_log);
   -m             List old log files available;
   -o outputfile  Output to "outputfile"
                   (default is ~/public_html/access.html)
   -x text        Exclude URLs containing "text"
   -y text        Exclude requesting hosts containing "text"
   -d             Include day-of-week bar chart
   -b             Include hour-of-day bar chart

Questions?

Post your questions or suggestions for improvement in the DCN Web Discussion.