CS501

MP8 - Whos Been Looking?


Introduction

In this MP you will create a shell script that will generate a web page summarizing who has accessed the web server on mathcssun1. The script you generate will not be huge, but will take a fair amount of careful thought.

Background

The Netscape web server on mathcssun1 maintains an access log in the file /usr/iplanet/servers/https-mathcssun1.emporia.edu/logs/access. If we use the tail command we would see:

$ tail /var/run/usrlocal1/netscape/server4/https-mathcssun.emporia.edu/logs/access

64.123.118.185 - - [24/Mar/2002:23:50:24 -0600] "GET / HTTP/1.0" 200 2121
64.123.118.185 - - [24/Mar/2002:23:50:27 -0600] "GET /access.cgi HTTP/1.0" 200 1087
64.123.118.185 - - [24/Mar/2002:23:50:24 -0600] "GET /stone.jpg HTTP/1.0" 200 5661
64.123.118.185 - - [24/Mar/2002:23:50:16 -0600] "GET /alog.cgi HTTP/1.0" 404 207
64.123.118.185 - - [24/Mar/2002:23:50:20 -0600] "GET /log.cgi HTTP/1.0" 404 207
64.123.118.185 - - [24/Mar/2002:23:50:39 -0600] "GET /access.cgi HTTP/1.0" 200 986
64.123.118.185 - - [24/Mar/2002:23:50:40 -0600] "GET /access.cgi HTTP/1.0" 200 986
64.123.118.185 - - [24/Mar/2002:23:50:36 -0600] "GET /access.cgi HTTP/1.0" 200 986
64.123.118.185 - - [24/Mar/2002:23:51:04 -0600] "GET /alog.cgi HTTP/1.0" 404 207
64.123.118.185 - - [24/Mar/2002:23:51:03 -0600] "GET /log.cgi HTTP/1.0" 404 207

Notice that the log contains the IP address and time and date of access.

The Task

  1. Create a script (use a shell script) that generates a web page that summarizes the accesses to the server during the current day. Take a look at http://mathcssun.emporia.edu/acess.cgi (physically located at /var/run/usrlocal1/netscape/server4/docs/access.cgi ) for some ideas.
  2. My solution to this problem used the date, cut and grep commands among others. You may also need to create some temporary files. Look here for some ideas on creating temporary files.
  3. The log is located at /var/run/usrlocal1/netscape/server4/https-mathcssun.emporia.edu/logs/access.
  4. "Spiffy" formatting of the log contents gains bonus points. Consider using nslookup to get the names of the lookers.

What You Will Turn In

A sheet containing your name, assignment number, course name, a listing of the cgi/bin script and the URL for the cgi/bin script file.