In my opinion awstats is THE apache log file analyzer solution. Unfortunately it does not support automatic configuration based on the webserver configuration, which is a great feature to miss IMHO. The following shell script has 3 different sections:
#!/bin/bash apacheconf="/etc/apache2/apache2.conf" awstatsconf="/etc/awstats/awstats.conf" indexfile="/home/ideart/public_html/awstats-index.html" urlbase="http://www.ideart.hu/awstats?config=" lockfile="/var/run/$0.pid" ############################################################################# #locking if [ -f "$lockfile" ]; then ps -p `cat "$lockfile"` >/dev/null || rm -f "$lockfile" # rm stale lockfile exit 0 fi trap "rm -f '$lockfile'" exit echo $$ > "$lockfile" awstatsdir=`dirname "$awstatsconf"` cat_apacheconf() { #echo "catting $1" >&2 depth=$(( $2 + 1 )) if [ $depth -ge 1000 ]; then return fi if [ -f "$1" ]; then # arg is a file cat "$1" | egrep -i '^[^#]*include[[:space:]]' | awk '{ print $2 }' | ( while read conf; do cat_apacheconf "$conf" $depth done ) cat "$1" elif [ -d "$1" ]; then # arg is a directory pushd "$1" > /dev/null ls -1 . | ( while read conf; do cat_apacheconf "$conf" $depth done ) popd > /dev/null else # arg is a glob pattern dir=`dirname "$1"` base=`basename "$1"` pushd "$dir" > /dev/null ls -1 $base | ( while read conf; do cat_apacheconf "$conf" $depth done ) popd > /dev/null fi cat_apacheconf "$apacheconf" | gawk -v awstatsdir="$awstatsdir" -v awstatsconf="$awstatsconf" -v indexfile="$indexfile" -v urlbase="$urlbase" ' BEGIN { IGNORECASE=1 servername=default virtualhost=default serveralias="" print "<h1>awstats index file</h1>" > indexfile } /^[^#]*virtualhost[[:space:]]/ { virtualhost = $2 gsub("[*<> ]","",virtualhost) } /^[^#]*servername[[:space:]]/ { servername = $2 } /^[^#]*serveralias[[:space:]]/ { serveralias = serveralias " " $2 } /^[^#]*transferlog[[:space:]]/ { transferlog = $2 print "<a href=\"" urlbase servername "_" virtualhost "\">" servername "_" virtualhost "</a><br />" >> indexfile newconf= awstatsdir "/awstats." servername "_" virtualhost ".conf" cmd="test -f " newconf if ( system(cmd) == 0 ) { #print newconf " exists already - skipping" } else { #print newconf " did not exist - creating" print "# autogenerated config file" >> newconf print "Include \"" awstatsconf "\"" >> newconf print "SiteDomain=\"" servername "\"" >> newconf print "HostAliases=\"" serveralias " 127.0.0.1 localhost\"" >> newconf print "LogFile=\"" transferlog "\"" >> newconf print "LogType=W" >> newconf print "LogFormat=1" >> newconf } serveralias="" } ' [ -f /etc/awstats/awstats.conf ] && /usr/lib/cgi-bin/awstats.pl -config=awstats -update >/dev/null for cfg in `find /etc/awstats -name 'awstats.*.conf' -printf '%f\n' | sed 's/^awstats\.\(.*\)\.conf/\1/'`; do /usr/lib/cgi-bin/awstats.pl -config=$cfg -update >/dev/null done exit 0