You are here

Repairing AWStats

Submitted by h2b on 2. June 2017 - 1:21
AWStats doesn't update statistics anymore although it worked fluently so far. The configured cron jobs are still running and manual calls yield no success either.

The following situation arises (for me the first time after years of usage): AWStats runs by crontab,  but all of a sudden no statistics are generated anymore; an error related to the execution of crontab can be ruled out. A manual call like

/usr/lib/cgi-bin/ -config=<config> -update

where <config> stands for the configuration in question,  results in an error message like

AWStats did not find any valid log lines that match your LogFormat parameter, in the 50th first non commented lines read of your log.
Your log file /var/log/apache2/ssl_access.log must have a bad format or LogFormat parameter setup does not match this format.
Your AWStats LogFormat parameter is:
This means each line in your web server log file need to have "combined log format" like this: - - [10/Jan/2001:02:14:14 +0200] "GET / HTTP/1.1" 200 1234 "" "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"
And this is an example of records AWStats found in your log file (the record number 50 in your log): - - [31/May/2017:20:45:53 +0200] "-" 408 1447 "-" "-"

Apparently, AWStats evaluates log-file entries with blank fields as - - [31/May/2017:20:45:53 +0200] "-" 408 1447 "-" "-"

(where stands for a concrete IP address) as invalid.

Such entries are appearing from time to time in webserver log files and are no problem normally. However, if more than 50 of that kind happen to occur without a break, AWStats stops working completely from this point on and for the future (exactly: until the log file is exchanged).

As a remedy, one can delete the lines in question from the log file (at least so many that less that 50 remain consecutively). Before you should stop the webserver (e.g., service apache2 stop) and afterwards start it again (service apache2 start). Then, AWStats continues its work (if configured as cron job) and updates the statistics from the formerly offending point on.



Initially this article erroneously had been titled "Repairing Webalizer". This has been corrected now.