Saturday, April 7, 2012

Apache log analyzer - AWStats & WebLogExpert

This blog has been moved to http://geekaider.com

There are many tools available on web which could read Apache/IIS log files and produce meaningful information/graphs out of it.
  • On client side I prefer WebLog Expert. 
  • On server side I prefer installing AWStats. 
In this blog we will:
  • Understand WebLog Expert and AWStats
  • Install AWStats on Linux

What is WebLog Expert?

WebLog Expert is a fast and powerful access log analyzer. It will give you information about your site's visitors: activity statistics, accessed files, paths through the site, information about referring pages, search engines, browsers, operating systems, and more. The program produces easy-to-read reports that include both text information (tables) and charts. WebLog Expert is capable of reading Apache and IIS log files. It can even read GZip and Zip log files. To install WebLog Expert on windows desktop download WLExpertSetup.exe and run the installation wizard. A freeware version known has WebLog Expert Lite is also available on internet.


Summary Report

Hourly and Daily Report

What is Awstats?

AWStats is a free powerful and featureful tool that generates graphical web server statistics from Apache log files. This log analyzer works as a CGI or from command line and shows you all possible information your log contains, in few graphical web pages.

AWStats installation on Linux

Prerequisites

How to install AWStats

1) Download RPM from awstats website and install it
rpm -ivh awstats-6.95-1.noarch.rpm
2) Copy model file
cp /usr/etc/awstats/awstats.model.conf /usr/local/awstats/wwwroot/cgi-bin/awstats.model.conf
3) Run auto-configuration script
cd /usr/local/awstats/tools/
perl awstats_configure.pl
Apache Config file path – /usr/local/apache2214/conf/httpd.conf
Do you want me to setup Apache to write 'combined' log files [y/N] ? y
Do you want me to build a new AWStats config/profile – Y
What is the name of your web site or profile analysis ? – demo
In which directory do you plan to store your config file(s) ? – /etc/awstats
Press ENTER to continue...
Press ENTER to finish...
4) Modify conf file
vi /etc/awstats/awstats.demo.conf
LogFile="/usr/local/apache2214/logs/access_log"
LogFormat=4 #or may be 1, (see awstats or apache documentation for help)
DirData="/var/lib/awstats"
5) Create Data Dir
mkdir /var/lib/awstats
6) Add authentication on awstats page
htpasswd -cm /etc/awstats/awstats.authfile statsadmin
password : ***
confirm password : ***
Change Ownership for this file
chown root:daemon /etc/awstats/awstats.authfile
Change permissions too
chmod 640 /etc/awstats/awstats.authfile
Make Apache aware of this authentication configuration
vi /usr/local/apache2214/conf/httpd.conf
#This secion is to provide Authentication on awstats
AuthType Basic
AuthName "Awstats Authentication"
AuthUserFile /etc/awstats/awstats.authfile
Require valid-user
7) Test & Reload new apache configuration
/usr/local/apache2214/bin/apachectl -t
Syntax OK 
/usr/local/apache2214/bin/apachectl -k graceful
8) Update the stats
perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=demo -update
9) Check browser
http://www.servername.com/awstats/awstats.pl?config=demo
AWstats - Summary, Monthly, Daily Report

AWStats - Day of week, Hourly Report

10) Add cronjob so that stats are updated daily by itself
crontab –e
@daily perl /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=demo1 –update

No comments:

Post a Comment