Applicable to:
- Plesk for Linux
Symptoms
- Unable to recalculate Awstats statistics in Plesk:
# plesk sbin statistics --calculate-one --domain-name=example.com
Webstat: awstats
Executing awstats...
Execution of /var/www/cgi-bin/awstats/awstats.pl -update -configdir=/usr/local/psa/etc/awstats -config=example.com-https -LogFile=/var/www/vhosts/system/example.com/logs/access_ssl_log.webstat failed with return code 1.
Stdout is
Create/Update database for config "/usr/local/psa/etc/awstats/awstats.example.com-https.conf" by AWStats version 7.4 (build 20150714)
From data in log file "/var/www/vhosts/system/example.com/logs/access_ssl_log.webstat"...
Phase 1 : First bypass old records, searching new record...
Direct access to last remembered record has fallen on another record.
So searching new records from beginning of log file...
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/www/vhosts/system/example.com/logs/access_ssl_log.webstat must have a bad format or LogFormat parameter setup does not match this format.
Your AWStats LogFormat parameter is:
1
This means each line in your web server log file need to have "combined log format" like this:
203.0.113.1 - - [10/Jan/2001:02:14:14 +0200] "GET / HTTP/1.1" 200 1234 "http://www.fromserver.com/from.htm" "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):
203.0.113.2 - - [28/Oct/2017:09:10:31 +0900] "\x15\x03\x00\x00\x02\x01\x00" 400 166 "-" "-"
Setup ('/usr/local/psa/etc/awstats/awstats.example.com-https.conf' file, web server or permissions) may be wrong.
Check config file, permissions and AWStats documentation (in 'docs' directory).
- The
access_ssl_log.webstat
log file is not rotated. As a result, Awstats webstat page shows 0 values (statistics is empty), while in fact domain's access_log contains entries.
Cause
Product issue:
-
#PPPM-9832 "If web statistics are not generated properly, customers can now understand why because AWStats errors are now logged and customers can see them in the panel.log file (if the show.util_exec_io setting is set to true in the panel.ini file)."
Fixed in:- Plesk Obsidian 26 January 2021 (Linux)
Resolution
Workaround
If update is not possible for some reason you may try the following
- Connect to the server via SSH
- Open the file from the error message (
/var/www/vhosts/system/example.com/logs/access_ssl_log.webstat
) in any text editor, and remove incorrectly formatted lines like:CONFIG_TEXT: 203.0.113.2 - - [28/Oct/2017:09:10:31 +0900] "\x15\x03\x00\x00\x02\x01\x00" 400 166 "-" "-"
The correct format would be:
CONFIG_TEXT: 203.0.113.1 - - [10/Jan/2001:02:14:14 +0200] "GET / HTTP/1.1" 200 1234 "http://www.fromserver.com/from.htm" "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"
- Recalculate statistics again:
# plesk sbin statistics --calculate-one --domain-name=example.com
Comments
4 comments
My file access_log.webstat has a size of 320 MB, and the access_ssl_log.webstat is 2 GB. I can't download them, to edit the wrong lines with an editor. From what I see, this error is happening since I updated from Plesk Onyx to Plesk Obsidian in november. Is there no way to restart these files? While the Plesk update arrives to correct it, can I delete them and execute something to rebuilt them?
Hello Rafa
> I can't download them, to edit the wrong lines with an editor.
No need to download them, they may be edited on the server while being connected over SSH.
> Is there no way to restart these files?
This may be achieved by configuring the log rotation: https://support.plesk.com/hc/en-us/articles/214527745-How-to-manage-log-rotation-for-a-domain-in-Plesk
To find the root cause, I would recommend submitting a support request to Plesk or Plesk Reseller depending on where the license was purchased:
https://support.plesk.com/hc/en-us/articles/213608509-How-to-submit-a-request-to-Plesk-support-
https://support.plesk.com/hc/en-us/articles/213953025-How-to-get-support-directly-from-Plesk-
Hi Ivan! Thanks for the reply!
> This may be achieved by configuring the log rotation: https://support.plesk.com/hc/en-us/articles/214527745-How-to-manage-log-rotation-for-a-domain-in-Plesk
In this section I found all the log files, except those that fail: access_log.webstat and access_ssl_log.webstat
Hello Rafa
Sorry for the late response.
To rotate the big log file, try the suggestion from the last message of this topic: https://talk.plesk.com/threads/access_log-webstat-growing-huge.343264/
As for applying the workaround, in that case, I would suggest sticking to editing the file in question via Linux command line (https://support.plesk.com/hc/en-us/articles/360001084114-How-to-edit-a-file-using-the-vi-utility-on-Linux).
Please sign in to leave a comment.