Whatever it may be, you should go with what works for you and your organization. In the grand scheme of things, you have to be convinced about the value you are getting for the money you are paying...

Home » Post Item » Installation and Configuration of AWStats on Tomcat Web Server

Installation and Configuration of AWStats on Tomcat Web Server

September 17, 2009

Here are the steps in installing and configuring AWstats in Tomcat Web Server

STEPS:

1.    Download awstats.war from the internet
2.    Since Tomcat disabled by default the CGI executions, we need to enable it by renaming the file servlets-cgi.renametojar to servlets-cgi.jar
Example:
[Tomcat_installation_path] = /usr/local/apache-tomcat-5.5.20

#cd /usr/local/apache-tomcat-5.5.20/server/lib
#mv servlets-cgi.renametojar servlets-cgi.jar

3.    Install AWStats
Since it is already a .war file, no need to install it by hand, you just need to copy this file to [Tomcat_installation_path]/webapps folder

#cp awstats.war [Tomcat_installation_path]/webapps

It would create an [Tomcat_installation_path]/webapps/awstats folder after copied.

4.    Configure AWStats
Let say our domain is www.mydomain.com

#cd /etc
#mkdir awstats
#cd [Tomcat_installation_path]/webapps/awstats/WEB-INF/cgi-bin
#cp awstats.model.conf /etc/awstats/awstats.www.mydomain.com.conf

5.    Edit awstats.conf
#vi /etc/awstats/awstats.www.mydomain.com.conf

Look for the line in the configuration and change the values as shown below:
Example:

LogFile=”LogFile=”/var/log/httpd/www.mydomain.com-combined_log”
LogType=W
LogFormat=1
LogSeparator=” ”
SiteDomain=”www.mydomain.com”
DNSLookup=1
DirData=”.”
DirCgi=”/cgi-bin”

6.    Update Site Statistics
Here you have two choices:
1.    Set AllowToUpdateStatsFromBrowser=1 in awstats.www.mydomain.com.conf file, see above. This will allow updating from the web browser with: http://www.mydomain.com/awstats/cgi-bin/awstats.pl?config=www.mydomain.com&update=1.
2.    Using SSH, go to [Tomca_install]/webapps/awstats/WEB-INF/cgi-bin folder and run perl awstats.pl -config=www.mydomain.com -update.
Example:
#/usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=www.mydomain.com -update
Create/Update database for config “/etc/awstats/awstats.www.mydomain.com.conf” by AWStats version 6.6 (build 1.887)From data in log file “/var/log/httpd/www.freelinuxtutorials-combined_log”…
Phase 1 : First bypass old records, searching new record…
Direct access after last parsed record (after line 10471)
Jumped lines in file: 10471
Found 10471 already parsed records.
Parsed lines in file: 160
Found 0 dropped records,
Found 0 corrupted records,
Found 0 old records,
Found 160 new qualified records.

7.View Site Statistics

Access it using your favorite browser. Type
http://www.mydomain.com/awstats/cgi-bin/awstats.pl?config=www.mydomain.com

8.Create crontab script in order to update the  log file analysis
#crontab –e

add this line
example:

0 * * * * /usr/local/awstats/wwwroot/cgi-bin/awstats.pl -config=www.mydomain.com -update > /root/awstatsjob/awstats.log

9. You can follow “Installation of GeoIP Information for AWStats” documentation to have a country information on your web/mail/ftp statistics.

 Original reference can be found on this links: http://www.freelinuxtutorials.com/tutorials/installation-and-configuration-of-awstats-on-apache-web-server/


Posted by linux at 6:21 am | permalink

All comments are moderated. Your comments will not appear here unless approved by the blog owner. Thank you.

Add a comment