Web statistics programs can make a website maintainer's life alot easier. From reports to your boss, to analysis of site activity, to finding out what's hot and what's not, having a website statistics program on your website can help you build and maintain a smarter, progressive, less bad-linked site. There are many tools, both commercial and freeware on the Internet to help you out. I am partial to Webstats by Gallanttech. I use it to create monthly reports of what is happenning on my site. This program is freeware.
But how about if you want to quickly sift through your live log, just to see what's happenning at a particular time? When you just want to look at the logfile contents in raw form? I find this necessary sometimes if the server runs slow for some reason, or other oddities which may come up. I thought a quick shell script could do the trick here, which simply runs through the logfile on a particular date, excluding a list of IP addresses. I added the list to take out activity by known sources, such as my own IP address, etc.
Script overview:
[date]
parameter (given in Apache's log date format)
1 #!/bin/sh 2 3 # NAME : browselog - script to peruse apache log without internal devel 4 # 5 # USAGE : mkthumbs [date] 6 # 7 # INPUTS : [date] 8 # 9 # EXAMPLE: ./browselog "12/Jan/2001" 10 # 11 # OUTPUTS: STDOUT 12 # 13 # $Id: browselog,v 1.0 2001.01.30 14:50:59 tkralidi Exp $ 14 15 if [ $# -ne 1 ]; then 16 echo "Usage: $0 [date]" 17 exit 1 18 fi 19 20 IPLIST="(192.168.1.8|192.168.1.5|192.168.1.7)" 21 WEBLOG="/usr/local/apache/logs/access_log" 22 23 grep $1 $WEBLOG | egrep -v $IPLIST |