Statistics are an important tool for every webmaster to control the popularity of his / her site and to improve the structure of the site. Here information about the statics available on this server are given
On this servers the web server log files are analyzed multiple times daily. For further information about the customization of ispman and the templates of ipsman please refer to the ispman documentation.
The following well known statistics packages are available:
Awstats
The statistics are accessibly at sub.domain.com/stats-awstats. These statistics are updated regularly via the following cron controlled script:
#!/bin/sh # awstatsreporting.sh # cronjob to update awstats pages for ISPMan virtual hosts # Author: Wim Kerkhoff <wim@nyetwork.org>, July 28, 2004 # See: http://www.nyetwork.org/wiki/AWStats # loosely based on awstats4vhost by Dave Capella # http://grox.net/software/mine/awstats4vhost/index.php # original copyright notice from install.awstats4vhost follows: # ETCDIR=/etc/awstats CFGHEADLESS=$ETCDIR/awstats.headless.conf LOGDIR=/ispman/logs CGI=/usr/lib/cgi-bin/awstats.pl DOMAIN_ROOT=/ispman/domains CACHE_ROOT=/ispman/domain/awstats CRONFILE=/etc/cron.hourly/awstats LOGRESOLVE=/usr/share/doc/awstats/examples/logresolvemerge.pl if [ "$UID" != "0" ] ; then echo "must be run by root. I quit." exit 2 fi rm -rf $CRONFILE for domain in $(ls $DOMAIN_ROOT/) ; do if [ -d $DOMAIN_ROOT/$domain/vhosts ] ; then for pre in $(ls $DOMAIN_ROOT/$domain/vhosts) ; do VHOST=$pre.$domain echo "$VHOST" LOGFILE="$LOGDIR/${VHOST}.access" CFGFILE=$ETCDIR/awstats.$VHOST.conf CACHEDIR="$CACHE_ROOT/$VHOST" if [ -r $LOGFILE ] ; then # make a cache directory. if [ ! -d "$CACHEDIR" ]; then mkdir -p "$CACHEDIR" fi # create config file SLASHED=`echo ${VHOST} | sed -e 's/\./\\\./g'` touch $CFGFILE chmod 644 $CFGFILE # generate config contents # append a * to ${LOGFILE} to process all # the rotated logs as well. cat <<EOF > ${CFGFILE} # LogFile="$LOGFILE" LogFile="$LOGRESOLVE ${LOGFILE} -dnslookup:4 |" DirData="${CACHEDIR}" HostAliases="${SLASHED} localhost 127\.0\.0\.1" SiteDomain="${VHOST}" # add the rest of the template cat $CFGHEADLESS >> $CFGFILE # update the stats... $CGI -config=$VHOST -update >> $CACHEDIR/update.log 2>&1 else rm -rf $CFGFILE $CACHEDIR fi done fi done
While awstats is also able to process ftp and mail log files currently only web statistics are processed regularly.
To get awstats to work add the following to your vhosts.conf.template:
RewriteEngine On RewriteRule /stats-aw /awstats-cgi-bin/awstats.pl [R] Alias /stats-files /usr/share/awstats ScriptAlias /awstats-cgi-bin /usr/lib/cgi-bin # Alias /stats-webalizer /ispman/domain/webalizer/<perl>$servername</perl>
Analog
Statistics creates by the analog analyzer are available at sub.domain.com/stats-analog. The following script is run nightly as a cron job to update the statistic information:
#!/bin/bash # Original Credits to Wil Cooley # analog="/usr/bin/analog" for domain in $(ls /ispman/domains/) ; do for pre in $(ls /ispman/domains/$domain/vhosts) ; do vhost=$pre.$domain if [ ! -d /ispman/domain/analog/$vhost ]; then mkdir /ispman/domain/analog/$vhost cp /usr/share/doc/analog/images/* /ispman/domain/analog/$vhost/ fi ${analog} +C"OUTFILE /ispman/domain/analog/$vhost/index.html" +C"LOGFILE (cont'ued) /ispman/logs/$vhost.access" +C"HOSTNAME $vhost" #+C"HOSTURL http://$vhost" #+C"VHOSTINCLUDE $vhost" done done
Webalizer
Finally webalizer is also installed and can be accessed at sub.domain.com/stats-webalizer. The cron job for log file processing looks as follows:
#!/bin/bash # Original Credits to Wil Cooley # webalizer="/usr/bin/webalizer" for domain in $(ls /ispman/domains/) ; do for pre in $(ls /ispman/domains/$domain/vhosts) ; do vhost=$pre.$domain if [ ! -d /ispman/domain/webalizer/$vhost ]; then mkdir /ispman/domain/webalizer/$vhost fi ${webalizer} -n $vhost -o /ispman/domain/webalizer/$vhost/ /ispman/logs/$vhost.access done done