• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved Misconfigured awstat?

L. Hagen

Basic Pleskian
Hi,

usually I thought "I have a fresh installed system. This canot happen to me". But I was wrong :( Whenever I try to access awstat I get a 404. I googled a lot and found some approaches as well here in the forum but for "older Plesk versions".

At first I tried to reinstall the awstat but this failed. Then I checked if the config files etc. are existing - and they do. Finally, I tried to manually re-calculate the statistics and got:

Code:
/opt/psa/admin/sbin/statistics --calculate-one --domain-name <hostname>

WARNING during statistics_collector execution: : statistics_collector[5802]: Relinking of virtual host logs `/opt/psa/admin/sbin/relink-vhost-logs --domain-name <hostname> --sys-user-login <admin username>' failed with code 3.
Stdout:
Stderr:'./<hostname>/logs' already exists, but has wrong access rights. Specify --force to override.
ERROR: Cannot relink logs. Target directory '/var/www/vhosts/<hostname>/logs' is in invalid state.

Well, because I've not changed any permissions, pathes or awstat config files, I'm wondering how this can be? I read that there is a "psa repair" command, but because I never have done this before and don't know the side effects, I like to ask here if someone else had this problem in the past and has a working solution, please.

best regards,
Lars
 
Last edited:
Hi L. Hagen,

issues/errors/problems MAY happen, even that they shouldn't - that's why Plesk invented several utilities, which are able to inspect and repair misconfigurations.


The Plesk Repair Utility even has the option to be used with the "-n" option string ( => Do not repair anything, check only ).

Examples:
Code:
plesk repair web example.com -n -v
Code:
plesk repair fs example.com -n -v
or
Code:
plesk repair web -n -v
Code:
plesk repair fs -n -v
or
Code:
plesk repair all -n -v

For more informations about the Plesk Repair Utility, pls. read: => Plesk Repair Utility
 
Hi UFHH01,

awesome! Thank you for your hint. This option was new to me. "Unfortunatly", no errors have been found running with "all". Do you have another idea how awstat can be convinced to run :rolleyes:
 
Hi L. Hagen,

you might consider to change the statistic component and retry your previous command "/opt/psa/admin/sbin/statistics ... " afterwards. If all went fine with "Webalizer" for example, consider to retry to use "AwStats".


... and pls. remove sensitive data ( username! ) from your provided log - entry for security reasons.
 
Hi UFHH01,

hmm, I was following your recomendation and have removed at first webalizer and then awstat, temporarily. After each removal I executed "/opt/psa/admin/sbin/statistics ... ", but I get allways the same error. In other words: currently, there is no analyzer installed but the error message remains... :(
 
Hi UFHH01,

well, I found the error based on your recommendation. The log-directory had 750 permissions, because I have a script that requires access to all vhost-logfiles. Don't know why "statistics" is so restrictive here. I hope that there is any way to bypass this....?!

Nevertheless, I changed the permissions to 700 and the statistics run without warnings and errors.
Here are my experiences:

I reinstalled "awstat", started it and got a "Bad gateway" from nginx. So I modified my nginx-config like this:

Code:
location ~ ^/(plesk-stat|webstat|webstat-ssl|ftpstat|anon_ftpstat|awstats-icon) {
   proxy_pass https://<ip-adress>:7081;
   proxy_set_header Host $host;
   proxy_set_header X-Real-IP $remote_addr;
   proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   proxy_set_header X-Accel-Internal /internal-nginx-static-location;
   access_log off;
}

Next try: awstat came accross again with 404-not found. Now I went to "Host settings" and disabled and re-enabled awstat.
Next try: awstat is starting now but prints

Code:
 This is the placeholder for Web statistics. If you see this page, that means that statistics for your server was not gathered yet, or bandwidth was not used. Statistics is typically set to run once every 24 hours. If you do not see a change to this page in the next 24 hours contact your server administrator for assistance.

Finally I removed the nginx directive again. It is not really required. The "bad gateway" doen't appear anymore after the "disable/re-enable" procedure.

The final question is now: why are the stats empty, even when I manually created it...?
 
Hi L. Hagen,

The log-directory had 750 permissions, because I have a script that requires access to all vhost-logfiles.
:rolleyes: - really? YOU modified permissions and wonder yourself afterwards, that some Plesk components doesn't work anymore as expected and intended? Sorry, but I can't understand that at all. :(
 
I was wondering myself that I forgot that permission change :oops: But in fact (and probably I'm completely wrong) I don't see any security issues here (it is not 777). I just gave the log (/var/www/vhosts/<vhostname>/log) directory group read+access permissions. So I don't understand the behaviour of the statististic component AND awstat does not show any data right now...
 
Back
Top