AWStats is a free powerful and featureful tool that generates advanced web, streaming, ftp or mail server statistics, graphically. 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. It uses a partial information file to be able to process large log files, often and quickly. It can analyze log files from all major server tools like Apache log files (NCSA combined/XLF/ELF log format or common/CLF log format), WebStar, IIS (W3C log format) and a lot of other web, proxy, wap, streaming servers, mail servers and some ftp servers.
Install awstats in Debian
#apt-get install awstats
This will complete the installation
Now you need to Run the awstats configure script located at cd /usr/share/doc/awstats/examples/awstats_configure.pl to setup awstats for the domain you want to monitor. You need to repeat the configuration process for each domain you want to monitor.
when this script starts it will prompt for some configuration questions first one is setup from non standard directory type yes and press enter
Webserver install location type /etc/apache2/httpd.conf and press enter
Need to create new config file type y and press enter
Define config file path as default one and and press enter
This will complete the configuration script setup
Now you need to set up an alias for awstats-icons in httpd.conf. Inserted it in the Aliases section. The awstats_configure.pl script adds it in the end of httpd.conf you need to comment or remove it.
Your entry for /awstats-icon/ in the Aliases section should look like:
Alias /awstats-icon/ /usr/share/awstats/icon/
Allow from all
Now you can restart apache using the following command
Now you need to configure for domain configuration file located at /etc/awstats/awstats.full-domain-name.conf and change the following parameters save and exit the file
SiteDomain=”your domain name”
Generate stats the first time by using the following command
Update for config “/etc/awstats/awstats.full-domain-name.conf”
With data in log file “/var/log/apache2/access.log”…
Phase 1 : First bypass old records, searching new record…
Searching new records from beginning of log file…
Phase 2 : Now process new records (Flush history on disk after 20000 hosts)…
Jumped lines in file: 0
Parsed lines in file: 1585
Found 0 dropped records,
Found 0 corrupted records,
Found 0 old records,
Found 1585 new qualified records.
You can now check the stats in your browser by point it to http://serverip/cgi-bin/awstats.pl?config=full-domain-name.You should see similar to the following screen
Cron Job Setup
If you want to get your website stats update every 5min you can use the following command
*/5 * * * * www-data [ -x /usr/lib/cgi-bin/awstats.pl -a -f /etc/awstats/awstats.conf -a -r /var/log/apache2/access.log ] && /usr/lib/cgi-bin/awstats.pl -config=full-domain-name -update >/dev/null
Possible error and Solution
When run awstats config script at the end you might see similar to the following error
—–> Create config file ‘/etc/awstats/awstats.Test.conf’
Error: Failed to open ‘/usr/share/doc/awstats/examples/wwwroot/cgi-bin/awstats.model.conf’ for read.
make sure you unzipped the awstats.model.conf file:
where you will find some important parameters near head of file, which are meant to be edited by package maintainers. Unfortunately this seems not to have happened for Debian.
Note:- You also may have to modify these paths in the generated apache2.conf manually afterwards.
I’ve got a successful Awstats install that I created using roughly the same procedure. I might have followed the debianhelp instructions though…
I was wondering if you know much about the cron part?
I can’t seem to get the cron working. I don’t have a special cron for awstats – I’ve got my logrotate set up as follows:
create 644 root adm
.org -update -awstatsprog=/path/to/cgi-bin/awstats.pl -dir=/path/to/awstats/ -buil
if [ -f /var/run/apache2.pid ]; then
/etc/init.d/apache2 restart > /dev/null
If I run “logrotate /etc/logrotate.conf from the command line, it works fine, but cron wont run it, despite logrotate being in /etc/cron.daily?
test -x /usr/sbin/logrotate || exit 0
Lachlan: even though your logrotate runs daily, you have set the config “weekly” in your logrotate file for apache. it will thus rotate only once every week. change it to “daily” if you want dayly rotation of your logs.
Is there an updated tutorial on this topic? I’m using Debian testing (sept 2009) and I’ve found that there is no wwwroot directory in /usr/share/doc/awstats/examples. I’ve also found that the awstats_configure.pl paths are still not changed by package maintainers.
Is there an easier to configure tool for web log analysis?
The following line above is wrong:
I’m using Debian 6 and Lighttpd as webserver and tomcat as App server. When I install AWstats, /usr/local/awstats folder is not being created. What is the work around for it?
Like most Linux packages, you need eleven million configuration steps. I go this working, but holy f**k! Does nobody in linux development land think about usability?
This tutorial fails horribly already in the first couple of steps on Debian Squeeze.
Definitely OUTDATED as of October 27th 2012
This tutorial is accurate as of 2007… can we pray for an updated tutorial?