NAME

awstats-update - update awstats' database files


SYNOPSIS

awstats-update [ -v | --verbose | -q | --quiet ]


DESCRIPTION

This program will update awstats' database files. It is typically called from a cron job to update the statistics on a daily basis.

When run, this program will search for all files matching:

    /etc/awstats/awstats.CONFIGNAME.conf

where CONFIGNAME is any name (other than ``model''). For each file found the following command is run:

    /usr/lib/cgi-bin/awstats.pl -config=CONFIGNAME -update

When called in ``quiet'' mode (the default), all standard output from the above command is suppressed unless it contains the word ``Error:''. This behavior is to support use in a cron job so that email is sent only if there is an error message (that is, if there is any output to stderr or if there is output to stdout containing the word ``Error:'').

Here is a typical entry in /etc/crontab to invoke awstats-update nightly and run it as the user named ``awstats'':

  15 2 * * * awstats [ -x /usr/sbin/awstats-update ] && umask 027 && nice /usr/sbin/awstats-update

It is suggested that you set EnableLockForUpdate=1 in your AWStats configuration file to prevent multiple awstats update processes from running simultaneously and corrupting the database files.


ENVIRONMENT

It is recommended that you use the environment variable LOGROTATE in your awstats config file as in the following example:

    LogFile="/var/log/apache2/access.log__LOGROTATE__"

The usefulness of this feature is apparent when using logrotate, which rotates Apache's log files on a weekly basis, renaming the old log file to ``access.log.1''. You can use the following crontab entry to collect statistics from the rotated log file before processing the new log file:

  15 2 * * * awstats [ -x /usr/sbin/awstats-update ] && umask 027 && LOGROTATE=.1 nice /usr/sbin/awstats-update && nice /usr/sbin/awstats-update

There is no problem with rerunning awstats on the rotated log file every day even though it is rotated weekly. AWStats will ignore old records.

Note: a cron script is automatically installed on Debian systems in /etc/cron.daily/awstats-update. The file /etc/crontab instructs cron to run this script every day at 6:25am, unless you are using anacron, in which case /etc/cron.d/anacron and /etc/anacrontab will cause the script to be run at 4:35am (or five minutes after you switch on your computer).


AUTHOR

Ken Neighbors <ken@nsds.com>