/var/net/sys/admin/blog
| More

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.

Leave a comment

Name: (Required)

E-mail: (Required)

Website:

Comment:


 

About FLT

This site is dedicated to everyone who likes to learn and explore the beautiful world of Linux. If you have comments and suggestions, please feel free to email at comments@freelinuxtutorials.com. I am happy to serve and share things esp. that is free and enjoyable as Linux.