0

I am seeing a problem on my server where awstats is deleting data from previous days. To be clear the data was being shown for these days up until the end of the month but then on the next month (not always on the 1st) about 1-2 weeks of data suddenly goes missing from the previous month. This happens every month.

I assume it is a problem with log rotation but it's hard to tell. The problem might be caused by the logresolvemerge tool (I have seperate logs for regular and SSL traffic). My awstats configuration is:

LogFile="/usr/share/awstats/tools/logresolvemerge.pl /var/log/httpd/[sitename]-sslaccess.log /var/log/httpd/[sitename]-access.log |"

Logrotate is configured as (/etc/logrotate.d/apache2):

/var/log/apache2/*.log {
    weekly
    missingok
    rotate 52
    compress
    delaycompress
    notifempty
    create 640 root adm
    sharedscripts
    postrotate
            if /etc/init.d/apache2 status > /dev/null ; then \
                /etc/init.d/apache2 reload > /dev/null; \
            fi;
    endscript
    prerotate
            /usr/local/bin/update.awstats.sh
            if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
                    run-parts /etc/logrotate.d/httpd-prerotate; \
            fi;
    endscript
}

/usr/local/bin/update.awstats.sh:

AWSTATSBINDIR=/usr/lib/cgi-bin/
AWSTATSCFGDIR=/etc/awstats

# Loop over configs
/usr/local/bin/awstats_updateall.pl now -awstatsprog=$AWSTATSBINDIR/awstats.pl -configdir=$AWSTATSCFGDIR

/usr/local/bin/awstats_updateall.pl is just the script from the awstats examples directory. It all seems pretty standard to me so I have no idea why stats just go missing AFTER they have been generated.

I've also notice that awstats has nearly 8000 awstats.[date].tmp.[number] files in /val/lib/awstats/ for just one month on a server running only 2 domains. That seems excessive and possibly related to my issue? The tmp files have the permissions:

SpliFF
  • 394
  • 2
  • 8
  • 24
  • When awstats cretae the stat, its after static file. Be sure nothing logrotate that directory – yagmoth555 Jul 10 '16 at 11:40
  • I'm not using the build_staticpages.pl script and the awstats.[date].txt files aren't static because they change when you do an update (however they aren't supposed to lose data either). Nonetheless it appears they are losing data. – SpliFF Jul 10 '16 at 23:33
  • Making it static is better, as if your log got compressed awstat no longer can access it – yagmoth555 Jul 10 '16 at 23:34
  • `logresolvmerge.pl` script can access and merge gzipped logs so that shouldn't be an issue. I've used it to manually rebuild stats in the past. – SpliFF Jul 10 '16 at 23:47

0 Answers0