Awstats: Error: Couldn’t open server log file … logresolvemerge.pl … access.log …. No such file or directory

1 minute read

After an upgrade from Debian 3.1 (sarge) to Debian 4.0 (etch), awstats stopped automatically updating.

Awstats was complaining that the log files could found. By logging in to the server, user www-data was able to open the files, but still awstats was complaining.

After upgrading, the behaviour of awstats seem to have changed a bit. Updating the stats using logresolvemerge.pl resulted in the following error when using the command line:

www-data@host:~$ /usr/share/doc/awstats/examples/awstats_updateall.pl now -awstatsprog=/usr/lib/cgi-bin/awstats.pl
/usr/lib/cgi-bin/awstats.pl -update -config=www.mysite.com -configdir="/etc/awstats"
Update for config "/etc/awstats/awstats.www.mysite.com.conf"
With data in log file "/usr/share/doc/awstats/examples/logresolvemerge.pl /var/log/apache2/access.log /var/log/apache2/access.log.1 |"...
Error: Couldn't open server log file "/usr/share/doc/awstats/examples/logresolvemerge.pl /var/log/apache2/access.log /var/log/apache2/access.log.1 |" : No such file or directory
Setup ('/etc/awstats/awstats.www.mysite.com.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).

To work around this error, one of the possible reason (if you can confirm that user www-data can open the log files) is that logresolvemerge.pl does not get automatically executed, it is possible to force this by changing a line in /etc/awstats/awstats.www.mysite.com.conf and change:

LogFile="/usr/share/doc/awstats/examples/logresolvemerge.pl /var/log/apache2/access.log /var/log/apache2/access.log.1 |"

To:

LogFile="perl /usr/share/doc/awstats/examples/logresolvemerge.pl /var/log/apache2/access.log /var/log/apache2/access.log.1 |"

Please change the value of LogFile accordingly do your settings. Basically add perl at the beginning of the statement.

This fixed my issue, hopefully it will do the same for people reading this page :smile: