Chapter 7. Logging
# mkdir /var/www/CHALK/usage
# mkdir /var/www/CHEESE/usage
# chmod g+ws /var/www/CHALK/usage
# chmod g+ws /var/www/CHEESE/usage
Figure 7-17. Creating the usage directories
To keep things under the editorial control of the web site managers we will copy the
webalizer configuration files into /var/lib/webalizer and change the group and
permissions to give them control.
# cp /etc/webalizer.conf /var/lib/webalizer/chalk.conf
# cp /etc/webalizer.conf /var/lib/webalizer/cheese.conf
# chgrp chalk /var/lib/webalizer/chalk.conf
# chgrp cheese /var/lib/webalizer/cheese.conf
# chmod g+w /var/lib/webalizer/chalk.conf
# chmod g+w /var/lib/webalizer/cheese.conf
Figure 7-18. Copying the configuration files
Next, we are going to edit half a dozen items in each of the configuration files.
Parameters to change in the webalizer configuration file
LogFile /var/log/httpd/cheese_log
This specifies the log file to read the raw data from.
LogType clf
This identifies the format of the log file as common log format.
OutputDir /var/www/CHEESE/usage
This identifies the directory in which the statistics are to be compiled for presen-
tation.
HistoryName /var/lib/webalizer/cheese.hist
This specifies a “working file” the system uses. By default it will appear in the
output directory, but we don’t want it in a downloadable location.
IncrementalName /var/lib/webalizer/cheese.current
This is another “working file” the system needs.
HostName cheese.dept.cam.ac.uk
This identifies the host name used to identify the site. For a virtual host it needs
to be set.
Finally, all we need to do is to make sure that the log analysis program gets run
over each of the web sites. It is run out of a daily cron job controlled by the file
/etc/cron.daily/00webalizer.
#! /bin/bash
# update access statistics for the web site
if [ -s /var/log/httpd/access_log ] ; then
/usr/bin/webalizer
fi
exit 0
Figure 7-19. The initial /etc/cron.daily/00webalizer file
60
Comentarios a estos manuales