cPanel AWStats Explained

cPanel AWStats Explained



AWStats is a free application that is powerful and packed with tools that generates advance statistics of Web, Ftp and Mail server graphically.  AWStats works as a CGI and shows you all information contained in logs via graphical web pages. It quickly analyze logs from tools like Web server (Apache & IIS), mail and FTP servers.

AWStats shows you the number of visits, visits duration, last visits, unique visitors and their country, OS/Browser type, most viewed pages, search engine and used keywords used to find your site etc. It can analyze a lot of log formats like Apache combined log file (XLF/ELF), IIS logs (W3C), Webstar native logs and other web, streaming, proxy server log files. It works as CGI from browser and command line.

By default AWStats on Cpanel updates its graph using log files every 24 hrs. But if some one wants to update their AWStats frequently then do the following:

(Note: It is assumed that you are having shell access of your Linux server)

Issue: AWStats not updating & “Update Now” option missing from Cpanel -> AWStats -> Domain to view logs -> Last update 28 Nov 2012 (Update now)

Solution: Login into your server via SSH

Then edit file

# vi /home/username/tmp/awstats/username.domainname.com.conf

Search for entry : AllowToUpdateFromBrowser=0

change it to i.e : AllowToUpdateFromBrowser=1

Save the file and close.

This will enable “update now” option in AWStats page. So that client can click in his Cpanel -> AWStats -> Domain to view logs -> to manually update stats at any time.
or you can directly run the following command as a root to generate stats for that particular user.

# /scripts/runweblogs username

Setup AWStats and access it from outside of Cpanel:

You can also set up AWStats and access it outside of your cPanel. It is very simple to set up and configure.

Follow the steps given below to access AWStats outside of your cPanel.

* Download AWStats from website (http://awstats.sourceforge.net/#DOWNLOAD)

# wget http://prdownloads.sourceforge.net/awstats/awstats-7.0.tar.gz

* Un-compress awstats-7.0.tar.gz in user’s home folder

# tar -zxvf awstats-7.0.tar.gz

* Then copy the contents of the uncompressed cgi-bin folder to the user cgi-bin directory (It will include awstats.model.conf, awstats.pl, plugins, lib and  lang sub-directories).
(Path for cgi-bin dir of AWStats is /home/user/Awstats7.0/wwwroot/cgi-bin)

* Go to user cgi-bin directory after copying the content

# cd /home/username/public_html/cgi-bin

* Then edit the top first line of awstats.pl file

ie : !/usr/bin/perl

* Change the above with the path where your Perl interpreter is installed. Default value works for most of the Linux OS, but it can also be

#!/usr/local/bin/perl

* Then move AWStats ‘icon’ sub-directory and its content in public_html directory, which is readable by web server

# mv /home/user/Awstats7.0/icons  /home/users/public_html/icons

* rename  awstats.model.conf file to awstats.domainname.conf in  /home/user/public_html/cgi-bin

# cd /home/user/public_html/cgi-bin/

# mv awstats.model.conf  awstats.domainname.conf

* Edit this awstats.domainname.conf file with your own setup

* Change LogFile value with the path of your Apache log file

ie: LogFile=”/usr/local/apache/domlogs/domain.com”

* Check ‘LogFormat’ has value ‘1’ (means “NCSA apache combined/ELF/XLF log format”)

* Change ‘DirIcons’ to relative path of icon directory.
ie: DirIcons=”/icons”

* Edit ‘SiteDomain’ with the domain name (Example: www.mydomain.com).

IMPORTANT

* Change ‘DirData’ to use the same Statistics file that Cpanel AWStats use.
ie: DirData=”/home/user/tmp/awstats/”

* Then Access AwStats by URL

www.domain.com/cgi-bin/awstats.pl?config=domain.com

Congratulations! You can now see Awstats outside of your cPanel.



Categories