AWSTAT is free an  very powerful log analyser tool for apache log files. After analyzing logs from apache, it present them in easy to understand graphical format. Awstat is short for Advanced Web statistics & it works on command line interface or on CGI.

In this tutorial, we will be installing AWSTAT on our Centos 7 machine for analyzing apache logs.

(Recommended read :Scheduling important jobs with crontab)



1- A website hosted on apache web server, to create one read below mentioned tutorials on apache web servers,

(Recommended reads- installing Apache, Securing apache with SSL cert & hardening tips for apache)

2- Epel repository enabled on the system, as Awstat packages are not available on default repositories. To enable epel-repo , run

$ rpm -Uvh


Installing Awstat

Once the epel-repository has been enabled on the system, awstat can be installed by running,

$ yum install awstat

When awstat is installed, it creates a file for apache at ‘/etc/httpd/conf.d/awstat.conf’ with some configurations. These configurations are good to be used incase web server &awstat are configured on the same machine but if awstat is on different machine than the webserver, then some changes are to be made to the file.


Configuring Apache for Awstat

To configure awstat for a remote web server, open /etc/httpd/conf.d/awstat.conf, & update the parameter ‘Allow from’ with the IP address of the web server

$ vi /etc/httpd/conf.d/awstat.conf

<Directory "/usr/share/awstats/wwwroot">
Options None
AllowOverride None
# Apache 2.4
Require local
<IfModule !mod_authz_core.c>
# Apache 2.2
Order allow,deny
Allow from
Allow from

Save the file & restart the apache services to implement the changes,

$ systemctl restart httpd


Configuring AWSTAT

For every website that we add to awstat, a different configuration file needs to be created with the website information . An example file is created in folder ‘/etc/awstats’ by the name ‘awstats.localhost.localdomain.conf’, we can make copies of it & configure our website with this,

$ cd /etc/awstats
$ cp awstats.localhost.localdomain.conf

Now open the file & edit the following three parameters to match your website,

$ vi

SiteDomain="" localhost

Last step is to update the configuration file, which can be done executing the command below,



Checking the awstat page

To test/check the awstat page, open web-browser & enter the following URL in the address bar,



Note- we can also schedule a cron job to update the awstat on regular basis. An example for the crontab

$ crontab –e
0 1 * * * /usr/share/awstats/wwwroot/cgi-bin/–update


We now end our tutorial on installing Awstat for analyzing apache logs, please leave your comments/queries in the comment box below.


If you think we have helped you or just want to support us, please consider these :-

Connect to us: Facebook | Twitter | Google Plus

Donate us some of you hard earned money: [paypal-donation]

Linux TechLab is thankful for your continued support.