@
you're reading...
Linux Tips and Tricks

Setup AWStats on CentOS 6 to analyze Apache Logs

Environment: CentOS 6 64bit with Apache already installed

AWStats is an opensource software that generates statistics graphically. For more info, visit awstats office website here.

1. Install Epel Repo
rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

2. Install awstats package.
yum install awstats

3. Setup apache for stats
By default AWStats creates an Apache configuration file /etc/httpd/conf.d/awstats.conf. If you are accessing awstats remotely then adjust the allow from line accordingly. Reload apache afterwards.

4. Create awstats config for the site that you want to analyze.
In this example, I wanted to analyze mysite.com. Copy the default config and name it just so that it relates to your sites name for easy identification.

cp /etc/awstats/awstats.localhost.localdomain.conf /etc/awstats/awstats.mysite.com.conf
vim /etc/awstats/awstats.mysite.com.conf

Update the ff lines below:
LogFile="/var/log/httpd/mysite.com-access_log"
SiteDomain="mysite.com"
HostAliases="IP_of_the_server mysite.com"

5. Create initial stats:
/usr/bin/perl /var/www/awstats/awstats.pl -config=mysite.com

6. If everything went well. Create a cron to update the stats.
Below cron updates the stats every hour.
01 * * * * perl /var/www/awstats/awstats.pl -config=mysite.com -update

7. Access awstats from the browser.
http://IP_of_the_server/awstats/awstats.pl?config=mysite.com

awstats

Advertisements

Discussion

One thought on “Setup AWStats on CentOS 6 to analyze Apache Logs

  1. Having read this I believed it was rather informative.
    I appreciate you finding the time and energy to put this information together.

    I once again find myself spending way too much time
    both reading and leaving comments. But so what, it was still
    worth it!

    Posted by real housewives of new jersey | December 19, 2015, 3:14 am

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s