I notice some of the issues in this bug relate to the way awstats is run
at log rotation time

The README.Debian recommends:

"Make sure to run AWStats right _before_ web logs are rotated.  For
example, insert the following lines in /etc/logrotate.d/apache2:

    prerotate
      if [ -x /usr/share/awstats/tools/update.sh ]; then
        su - -c /usr/share/awstats/tools/update.sh www-data
      fi
    endscript"

-----------------------------


This means that

a) sharedscripts must be set in logrotate

b) data is likely to be missed if it is logged between the time
update.sh finishes and the rotation of a file for any particular vhost

Why does the README insist on prerotate and not use postrotate?

I've discovered that after rotation, logrotate can give the rotated
filename to the postrotate script, and using nosharedscripts, logrotate
can call awstats multiple times, once for each vhost, just as it
finishes the rotation of that host:


  nosharedscripts
  postrotate
      /path-to-cgi/awstats.pl -LogFile=$1
  endscript

Where it says `$1' in the postrotate script, logrotate actually puts the
rotated filename, e.g.
     /var/log/apache2/vhost1/access.log.1

so it will override the normal filename defined in
/etc/awstats/awstats.vhost1.com.conf

The normal conf file will still work normally from cron.

All that is needed is some wrapper script around awstats to select the
correct domain based on the path in $1 and pass the -config option to
awstats too

Does this address all the issues raised by contributors to this bug report?




-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to