Applicable to:
- Plesk for Linux
- Plesk for Windows
Question
How to change statistics from AWStats to GoAccess/Webalizer statistics tools in Plesk?
Answer
- Log in to Plesk.
- Go Domains > example.com > Hosting Settings > Web scripting and statistics section.
-
Select the required web statistics utility from the drop-down menu and click Ok
- Connect to the Plesk server via SSH.
-
Create a backup of psa database:
# plesk db dump > /root/dump_psa_before_script.sql
-
Generate a file with all domains:
# plesk bin site --list > domains.txt
-
Create a file
/root/webstat_changewith the following content:#!/bin/bash plesk db -N -e "select Templates.name from Templates,clients,TmplData where Templates.owner_id=clients.id and Templates.type='domain' and Templates.id=TmplData.tmpl_id and TmplData.element='webstat' and TmplData.value='awstats';" > /root/templates.txt plesk db -N -e "select clients.login from Templates,clients,TmplData where Templates.owner_id=clients.id and Templates.type='domain' and Templates.id=TmplData.tmpl_id and TmplData.element='webstat' and TmplData.value='awstats';" > /root/owner.txt file1="/root/templates.txt" file2="/root/owner.txt" N=`cat /root/templates.txt | wc -l` for i in `seq 1 $N`; do plesk bin service_plan -u "`cat $file1 | awk NR==$i`" -owner "`cat $file2 | awk NR==$i`" -webstat goaccess done plesk db -N -e "select domains.name from hosting,domains where hosting.webstat='awstats' and hosting.dom_id=domains.id;" > /root/subscriptions.txt file3="/root/subscriptions.txt" while read line do plesk bin domain -u "$line" -webstat goaccess done < $file3
-
Make the file
/root/webstat_changeexecutable:# chmod +x /root/webstat_change
-
Run the script
/root/webstat_changeto switch the webstat from AWStats to Webalizer:# /root/webstat_change
-
Make sure that there are no service plans or domains with AWStats webstat (no output should appear as a result of the execution of commands below):
# plesk db "select Templates.id,Templates.name,TmplData.value from Templates, TmplData where Templates.type='domain' and Templates.id=TmplData.tmpl_id and TmplData.element='webstat' and TmplData.value='awstats';"
# plesk db "select domains.name, hosting.webstat from hosting,domains where hosting.webstat='awstats' and hosting.dom_id=domains.id;"
- Connect to the Plesk server via RDP.
- Start a command prompt as an Administrator.
-
Create a backup of psa database:
C:\> plesk db dump psa > C:\psa_backup_webstat.sql
-
Execute the following commands to switch the webstat from AWStats to Webalizer:
C:\> plesk db "update TmplData set value='webalizer' where element='webstat' and value='awstats';"
plesk db -N -e "select domains.name from hosting,domains where hosting.webstat='awstats' and hosting.dom_id=domains.id;" > C:\domains.txt
for /f "tokens=*" %a in ('type C:\domains.txt') do plesk bin domain -u "%a" -webstat webalizer
Make sure that there are no service plans or domains with AWStats webstat (no output should appear as a result of the execution of commands below):
C:\> plesk db "select * from TmplData where element='webstat' and value='awstats';"
plesk db "select domains.name from hosting,domains where hosting.webstat='awstats' and hosting.dom_id=domains.id;"
Comments
Please sign in to leave a comment.