Articles in this section

How to change statistics tool from AWStats to GoAccess for domains in Plesk?

kb: technical Plesk Obsidian for Linux

Applicable to:

  • Plesk for Linux
  • Plesk for Windows

Question

How to change statistics from AWStats to GoAccess/Webalizer statistics tools in Plesk?

Answer

For one domain

 

  1. Log in to Plesk.
  2. Go Domains > example.com > Hosting Settings > Web scripting and statistics section.
  3. Select the required web statistics utility from the drop-down menu and click Ok



     

For selected/all domains and Service plans in Plesk for Linux

 

  1. Connect to the Plesk server via SSH.
  2. Create a backup of psa database:

    # plesk db dump > /root/dump_psa_before_script.sql

  3. Generate a file with all domains:

    # plesk bin site --list > domains.txt

  4. Create a file /root/webstat_change with 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
  5. Make the file /root/webstat_change executable:

    # chmod +x /root/webstat_change

  6. Run the script /root/webstat_change to switch the webstat from AWStats to Webalizer:

    # /root/webstat_change

  7. 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;"

 

For selected/all domains and Service plans in Plesk for Windows

 

  1. Connect to the Plesk server via RDP.
  2. Start a command prompt as an Administrator.
  3. Create a backup of psa database:

    C:\> plesk db dump psa > C:\psa_backup_webstat.sql

  4. 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
     

  5. 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;"

 

 

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.