The default configuration for Webalizer analyzes the default Apache logfile at 4:02 a.m. each day, as long as that logfile is not empty. The results can be read by using a browser on the same machine and accessing
Figure 7-30. Webalizer web usage report
7.12.1.1. Analyzing virtual host logfiles
This configuration assumes that your Apache virtual host logfiles are named
To configure Webalizer to analyze your virtual host logfiles each day, create the file
#! /bin/bash
# update access statistics for virtual hosts
CONF=/etc/httpd/conf/httpd.conf
for NAME in $(sed -n 's=^[^#]*CustomLog logs/([^ ]*)-.*=1=p' $CONF)
do
mkdir /var/www/usage/$NAME
chmod a+rx /var/www/usage/$NAME
LOG=/var/log/httpd/${NAME}-access_log
if [ -s $NAME ]
then
exec /usr/bin/webalizer -Q -o /var/www/usage/$NAME $LOG
fi
done
Make this file readable and executable by
# chmod u+rx /etc/cron.daily/00webalizer-vhosts
Next, edit
...(Lines snipped)...
This will ensure that a separate analysis history is maintained for each virtual host.
The virtual host logfiles will be analyzed every morning at 4:02 a.m., and the reports will be accessible at
7.12.1.2. Analyzing the FTP logfile
To analyze the
#! /bin/bash
# update access statistics for ftp
if [ -s /var/log/xferlog ]; then
exec /usr/bin/webalizer -Q -F ftp -o /var/www/usage/ftp /var/log/xferlog
fi
Make this file readable and executable by
# chmod u+rx /etc/cron.daily/00webalizer-ftp
Then create the directory
# mkdir /var/www/usage/ftp
# chmod a+r /var/www/usage/ftp
Make sure that you have made the changes to
Your FTP usage statistics will now be analyzed each day at 4:02 a.m. along with your web statistics. The reports will be accessible at
7.12.1.3. Accessing the usage statistics from another location
It's often inconvenient to access the usage statistics from the same machine that is running Apache. To make the statistics password-protected and accessible from any system, edit the file
#
# This configuration file maps the Webalizer log-analysis
# results (generated daily) into the URL space. By default
# these results are only accessible from the local host.
#
Alias /usage /var/www/usage
<Location /usage>
Order deny,allow
Allow from ALL
AuthType Basic
AuthName 'usage statistics'