Beware the addictive logs!
Once you have built a web site, inevitably the time will come when you want to pay
more attention to how people view the site. There are several log files that are
generated by the httpd server which are of use to people who want to calculate
the use of their web pages. These logs are:
access_log: this log records: what machine made a request, the date of the request, the file requested, the referring page, and the type of browser used.
194.176.43.158 - - [29/Oct/1998:06:24:52 -0500] "GET /~santiago/photos/tatoo/ima
ges/ HTTP/1.0" 200 2511 "http://ink.yahoo.com/bin/query?p=%22tatoo+images%22&hc=
0&hs=0" "Mozilla/4.03 [en] (Win95; I)"
error_log: this log records problems encountered by the web server.
[Tue Feb 27 21:07:54 1996] httpd: access to /disk03/itp/list_o_projects.html fai
led for client-71-215.online.apple.com, reason: No file matching URL: /list_o_pr
ojects.html from -
referer_log: this log records what link a user followed to reach a particular page. (This is now part of the access_log, but on some servers you might see it separate.)
[27/Feb/1996:21:11:57] http://www.photoserve.com/Photosites.html -> /~student/pi
cture_projects/
agent_log: this log records what browser a user uses. (This is also part of the access_log now.)
[27/Feb/1996:21:22:47] Mozilla/1.22 (Windows; U; 16bit)
But how do I use them?
The simplest way to use the logs is to read them. You'll find the logs on ITP servers at the location
/usr/local/etc/httpd/logs. You can use a command like more or tail to read them.
You'll need to use a command like grep to search for a string. For example:
grep '/~boom/' /usr/local/etc/httpd/logs/access_log > ./boomlog10.14
In this example (typed from my home directory), I search the accesslog, and write the
result of my search to a file in my own directory. You can also string searches together
using the "pipe." For example:
grep '/~boom/' /usr/local/etc/httpd/logs/access_log | grep '.html' | more
This will refine the previous search by searching again for only files that have .html
in their names, and then displaying the result to the screen instead writing it to a file.
Building Web Sites - ITP Fall 2000 - Mike Cosaboom, Instructor
mc39@acf2.nyu.edu