Analyzing Web and FTP Logs
Fedora provides the Webalizer tool for analyzing Apache and vsftp logfiles, but the default configuration works only with the default Apache virtual host. With a few minutes of configuration, Webalizer can analyze the logfiles off all of your Apache virtual hosts as well as your vsftp server.
How Do I Do That?
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 http://localhost/usage/, which displays the report page. A sample report page is shown in Figure 7-30.
Figure 7-30. Webalizer web usage report
Analyzing virtual host logfiles
Tip
This configuration assumes that your Apache virtual host logfiles are named /var/log/httpd/<virtualhostname>-<access_log> and are in combined
format.
To configure Webalizer to analyze your virtual host logfiles each day, create the file /etc/cron.daily/00webalizer-vhosts:
#! /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 fi
Make this file readable and executable by root:
# chmod u+rx ...
Get Fedora Linux now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.