Installation and Configuration of AWStats on Tomcat Web Server

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.

Share

About the author

tux

View all posts

7 Comments

  • of course like yⲟur web-site but yⲟu need to check the spelling on seᴠeral of yoսr posts.
    Many of them ɑre rife with spelling issues and I find іt vᥱry bothersome tⲟ teⅼl thhe truth
    oon the othеr һand I աill surely come back again.

  • Please let me know if you’re looking for a article writer for your blog. You have some really good posts and I believe I would be a good asset. If you ever want to take some of the load off, I’d really like to write some articles for your blog in exchange for a link back to mine. Please send me an email if interested. Cheers!

  • Great weblog right here! Also your web site a lot up fast! What host are you the usage of? Can I get your associate link on your host? I want my web site loaded up as quickly as yours lol

  • Well I truly liked reading it. This subject offered by you is very constructive for correct planning.

  • What i do not realize is in fact how you are now not actually much more smartly-appreciated than you might be right now. You are so intelligent. You already know thus significantly with regards to this subject, produced me individually imagine it from a lot of numerous angles. Its like men and women aren’t interested until it is one thing to do with Lady gaga! Your own stuffs outstanding. At all times maintain it up!

  • Excellent post. I used to be checking constantly this blog and I am impressed! Very helpful info specially the last phase 🙂 I maintain such info much. I was seeking this certain info for a long time. Thank you and best of luck.

Leave a Reply