Linux: Install JAWStats – Beautiful Statistic using AWStats Core

If you are a webmaster, then you should know the well-known log analyzer software called AWStats (Advanced Web Statistics). AWStats will convert your Apache access logs into a statistic page with lot of graphs and infographics.

One thing lack of it is the way AWStats represent the data in HTML. So, we will use JAWStats, another extension created in conjunction with AWStats and produces clear and informative charts, graphs and tables about your website visitors.

To do this, we need to have AWStats installed. JAWStats will use AWStats’s Data File (for example: awstats092011.domainname.com.txt) as the database to generate a beautiful statistic page. I will use variable as below:

OS: CentOS 6.2 64bit
AWStats path: /var/www/html/awstats
AWStats CGI path: /var/www/cgi-bin
JAWStats path: /var/www/html/jawstats
Domain: myseri.com.my
Log location: /var/log/httpd/myseri.com.my

AWStats

1. Download AWStats from the main website:

$ cd /usr/local/src
$ wget http://prdownloads.sourceforge.net/awstats/awstats-7.0.tar.gz
$ tar -xzf awstats-7.0.tar.gz

2. Install AWStats:

$ mv /usr/local/src/awstats-7.0/wwwroot/cgi-bin/* /var/www/cgi-bin
$ mv /usr/local/src/awstats-7.0/wwwroot/* /var/www/html/awstats

3. Configure AWStats to process our domain’s log file in cgi-bin folder:

$ cd /var/www/cgi-bin
$ cp awstats.model.conf awstats.myseri.com.my.conf

Open the domain’s configuration file and edit following line via text editor:

LogFile="/var/log/httpd/mylog.log"
SiteDomain="myseri.com.my"
HostAliases="www.myseri.com.my REGEX[myseri\.com.my$]"
DirCgi="/var/www/cgi-bin"
DirIcons="../awstats/icon"

4. Let AWStats run to generate the statistic data:

/var/www/cgi-bin/awstats.pl -config=myseri.com.my -update

Note: It might take some times for this process to complete depending on your log size

5. Once done, we need to allow AWStats to update the statistic automatically every 2 hours via cron job:

$ crontab -e

Add following line:

0 */2 * * * /var/www/cgi-bin/awstats.pl -config=myseri.com.my -update

JAWStats

1. Download JAWStats:

$ mkdir -p cd /usr/local/src/jawstats
$ wget http://static.jawstats.com/src/jawstats-0.7beta.tar.gz
$ tar -xzf jawstats-0.7beta.tar.gz

UPDATE: I received a lot of feedback that PHP 5.3 will cause a blank page to JAWStats. If you are using PHP 5.3 and above, you might need to download the latest version in GitHub here: https://github.com/mimesis/jawstats/downloads

2. Copy the JAWStats folder to website directory and copy the configuration file as well:

$ mv /usr/local/src/jawstats /var/www/html
$ cd /var/www/html/jawstats
$ cp config.dist.php config.php

3. Configure JAWStats by editing config.php via text editor and add following line:

$aConfig["myseri.com.my"] = array(
"statspath" => "/var/www/cgi-bin/",
"updatepath" => "/var/www/cgi-bin/",
"siteurl" => "http://www.myseri.com.my",
"sitename" => "myseri.com.my",
"theme" => "default",
"fadespeed" => 250,
"password" => "mypassword",
"includes" => "",
"language" => "en-gb"
);

 

Result

To see the result, just go to the browser at http://192.168.0.55/jawstats/ (this is my web server main IP) and you should see something like below:

The data in this page is updated once every 2 hours depending on how you setup the cron job for AWStats to run. You might need to increate PHP memory_limit to higher depending on how big your data generated by AWstats.

3 thoughts on “Linux: Install JAWStats – Beautiful Statistic using AWStats Core

    1. What is your PHP’s memory_limit? Is AWStats data exist in the server? Usually it is located under cgi-bin folder for example: awstats012012.www.mydomain.com.txt (data for January 2012 for http://www.mydomain.com)

      Reply

      1. memory_limit = 128M
        AWStats data does exist under cgi-bin folder
        i installed it on freebsd and it worked perfectly.i think there is something wrong with the package on centos as i took the access.log from the centos server and run the awstats on the freebsd one and it worked but when i run the awstats on the centos and take the report and try to view it by jawstats on freebsd it returns white page.

        Reply

Leave a Reply

Your email address will not be published. Required fields are marked *