• 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

Awstats and Plesk

B

baravalle

Guest
Hi,
It took me some time, but I managed to configure Plesk with Awstats and now I tought that it would have been good to share my results.

Trying to have awstats working with Plesk is not too easy - it took me a few hours. And in fact is not that integrated...

Anyway, that's how I've done it.

The most important point is having the directory layout that Plesk expects.

That, at least in my case, was not the one that I had with my normal RPM installation on Centos.

Here are the steps to solve the problem(s). You will have to create symbolic links to the files.

Plesk is expecting to find:
/var/www/cgi-bin/awstats (in my system I had /var/www/awstats)
/var/share/awstats/ with the awstats *.pl files (in my system they were in /usr/bin)
/usr/local/psa/etc/awstats/awstats.domainname-http.conf (in my system the configuration files were in /etc/awstats and had a different name pattern)

Use:
rpm -ql awstats

to find where your awstats has installed the files.

After doing that, to test if you are going in the right direction, try to run:

/usr/bin/awstats_updateall.pl now -confdir="/usr/local/psa/etc" -awstatsprog="/var/www/awstats/awstats.pl"

(use your awstats.pl path)

If it works, then run the Plesk program that generates statistics, to make sure that everything is fine:
/usr/local/psa/admin/sbin/statistics

Debug as needed in this step...

Sidenote: the awstats configuration files are not updated (apparently) when you update the domain aliases. If you update your domain aliases you will have to update them in the configuration file by hand.

If you have domains that you do not manage with Plesk in your server (I do have some of them, for non profit organisations), you can mimic the plesk scripts with a couple of scripts.

First, you need to have the log file processing enabled in your crontab.

I'm using this slightly modified version of the script included with awstats (it's in /etc/cron.daily/00awstats in my system):
#!/bin/bash

if [ -f /var/log/httpd/access_log ] ; then
exec /usr/bin/awstats_updateall.pl now -configdir="/etc/awstats" -awstatsprog="/var/www/awstats/awstats.pl" >/dev/null
fi

if [ -f /var/log/httpd/access_log ] ; then
exec /usr/bin/awstats_updateall.pl now -configdir="/usr/local/psa/etc/awstats" -awstatsprog="/var/www/awstats/awstats.pl" >/dev/null
fi

exit 0

And then you need a script to create the reports that are not processed by Plesk (apparently Plesk is processing just the domains that are managed by Plesk itself - which makes sense).


This one (adapt the domains) is what I'm using:

#!/bin/bash
domains_to_process=("baravalle.it" "phpgrabcomics.org" "server.phpgrabcomics.org" "verdibiellesi.it")

len=${#domains_to_process[@]}

i=0
while [ $i -lt $len ]; do
awstats_buildstaticpages.pl -config=${domains_to_process[$i]}-http --configdir="/usr/local/psa/etc/awstats" -lang=it -dir=/home/httpd/vhosts/${domains_to_process[$i]}/statistics/webstat -awstatsprog=/var/www/awstats/awstats.pl
let i++
done

You will have to insert it in your crontab (it needs to be the crontab of a user that has write access to the directories where you are saving you reports).

Enjoy...

Andres
 
I found a much easier solution...

I changed a single domain to use AWstats i then ran the statistics application and looked for file not found etc...

I then did a locate for the following files: awstats.pl and awstats_buildstaticpages.pl

after i found these i looked in the plesk config file (/etc/psa/psa.conf)
i looked for the lines
# AWStats
AWSTATS_ETC_D /etc/awstats
and changed the following 2 lines to:
AWSTATS_BIN_D /usr/share/awstats/wwwroot/cgi-bin
AWSTATS_TOOLS_D /usr/share/awstats/tools
i then ran the statistics tool once again and all was well and working!
Job done Full AWstats up and running ;)

Enjoy!

** Update ** sorry forgot to mention that i also updated the awstats.conf file in (/etc/httpd/conf.d/awstats.conf) to allow for global access as images where not loading
 
Hi DavidCollom,

Thanks for your tips but which linux distribution are you on cause I don't have any of the folders asked to change :AWSTATS_BIN_D and AWSTATS_TOOLS_D...

I'm on Debian Sarge 3.1.

Thanks
 
Originally posted by dfuzion
Hi DavidCollom,

Thanks for your tips but which linux distribution are you on cause I don't have any of the folders asked to change :AWSTATS_BIN_D and AWSTATS_TOOLS_D...

I'm on Debian Sarge 3.1.

Thanks
Hi, Im using Fedora Core 4 updated to FC5
This was also a clean install sorry
 
Thanks. My awstats config seems to be ok but I still have no cronjob and statictics are the same for each domain... Waiting for a fix from swsoft...
 
hmm weird. Ive just gone through all of my crons and theirs awstats running hourly! not sure why? its not plesk's stats just awstats directly! ive added two domains to use awstats now and all is looking ok.. no duplicate details!
altho i did notice awstats took quite a bit longer to compile, altho their is a lot more detail used in awstats to webalizer.

I do not have any crontabs other than the one above from awstats its self and could not find any. i might simply create my own and see where it go's from there :)
 
i have changed the paths in /etc/psa/psa.conf

to

# AWStats
AWSTATS_ETC_D /etc/awstats


and

AWSTATS_BIN_D /srv/www/cgi-bin
AWSTATS_TOOLS_D /usr/share/doc/packages/awstats/tools

system suse 10.0x64
and i still got error:

statistics: Unable to execute /usr/share/doc/packages/awstats/tools/awstats_buildingstaticpages.pl -awstatsprog=/srv/www/cgi-bin/awstats.pl --configdir=/usr/local/psa/etc/awstats -config=domain.com -dir=/srv/www/vhosts/domain.com/webstat/

what should i do to get this working??

please help me with that.
 
Hi,
did you try to run the command straight from the command line? does it work in that way?

Andres
 
Hi there,
I checked and on my system I do not have the file awstats_buildingstaticpages.pl.

You can try the method I suggested in my first post, or wait for feedback from DavidCollom.

Andres
 
I could not find any references to a file
awstats_buildingstaticpages.pl

here is a sample of my output from running "/usr/local/psa/admin/sbin/statistics" Located in /etc/cron.daily/50plesk.daily.sh
Build main page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=xxxxxxx.co.uk-ftp -staticlinks -configdir=/usr/local/psa/etc/awstats -output
Build alldomains page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=xxxxxxx.co.uk-ftp -staticlinks -configdir=/usr/local/psa/etc/awstats -output=alldomains
Build allhosts page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=xxxxxxx.co.uk-ftp -staticlinks -configdir=/usr/local/psa/etc/awstats -output=allhosts
Build lasthosts page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=xxxxxxx.co.uk-ftp -staticlinks -configdir=/usr/local/psa/etc/awstats -output=lasthosts
Build unknownip page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=xxxxxxx.co.uk-ftp -staticlinks -configdir=/usr/local/psa/etc/awstats -output=unknownip
Build allrobots page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=xxxxxxx.co.uk-ftp -staticlinks -configdir=/usr/local/psa/etc/awstats -output=allrobots
Build lastrobots page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=xxxxxxx.co.uk-ftp -staticlinks -configdir=/usr/local/psa/etc/awstats -output=lastrobots
Build session page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=xxxxxxx.co.uk-ftp -staticlinks -configdir=/usr/local/psa/etc/awstats -output=session
Build urldetail page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=xxxxxxx.co.uk-ftp -staticlinks -configdir=/usr/local/psa/etc/awstats -output=urldetail
Build urlentry page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=xxxxxxx.co.uk-ftp -staticlinks -configdir=/usr/local/psa/etc/awstats -output=urlentry
Build urlexit page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=xxxxxxx.co.uk-ftp -staticlinks -configdir=/usr/local/psa/etc/awstats -output=urlexit
Build osdetail page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=xxxxxxx.co.uk-ftp -staticlinks -configdir=/usr/local/psa/etc/awstats -output=osdetail
Build unknownos page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=xxxxxxx.co.uk-ftp -staticlinks -configdir=/usr/local/psa/etc/awstats -output=unknownos
Build browserdetail page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=xxxxxxx.co.uk-ftp -staticlinks -configdir=/usr/local/psa/etc/awstats -output=browserdetail
Build unknownbrowser page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=xxxxxxx.co.uk-ftp -staticlinks -configdir=/usr/local/psa/etc/awstats -output=unknownbrowser
Build refererse page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=xxxxxxx.co.uk-ftp -staticlinks -configdir=/usr/local/psa/etc/awstats -output=refererse
Build refererpages page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=xxxxxxx.co.uk-ftp -staticlinks -configdir=/usr/local/psa/etc/awstats -output=refererpages
Build keyphrases page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=xxxxxxx.co.uk-ftp -staticlinks -configdir=/usr/local/psa/etc/awstats -output=keyphrases
Build keywords page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=xxxxxxx.co.uk-ftp -staticlinks -configdir=/usr/local/psa/etc/awstats -output=keywords
Build errors404 page: "/usr/share/awstats/wwwroot/cgi-bin/awstats.pl" -config=xxxxxxx.co.uk-ftp -staticlinks -configdir=/usr/local/psa/etc/awstats -output=errors404

I also have the package "awstats-6.5-7.fc5" installed at this time
 
Back
Top