Awstats Debian

How to install awstats and use it


You first, of course, need to install the corresponding package, so :

apt-get install awstats

if you didn't still install a httpd, let's do it. I did choose apache by simplicity.

Configuration file of awstats

Now, you have to edit a file, to let awstats known how to read and analyze your logs files, and where this log file is located on the server.
On a debian system, the file that needs to be edited is :


First create a backup of this files, it's always a good practice to do that, before editing any important files. So :

# cp /etc/awstats/awstats.conf /etc/awstats/awstats.conf.bkp

Tell awstats which log file to analyze

You have to tell awstats where is your apache log, you have to change this line :


to your needs. So, if you have you log file in this directory, by instance :


and your log file is :


Replace the line :


with this line :

Note, that there is a lot of comment in awstats configuration file, so enjoy it ! You will probably learn a lot of things !!

Tell awstats how your log file is formatted

You have to tell awstats how your log apache file are formatted, so you have to look inside your httpd.conf. You can find more information about logs formatting with apache on this page
You have to look at the directive :


in your apache configuration file.
So, change this line in awstats :


according to your needs.
As my formatting in httpd.conf was this one :
LogFormat "%h %l %u %t \"%r\" %>s %b %T \"%{Referer}i\" \"%{User-Agent}i\"" combined

I changed the line in awstats configuration file to this one :
LogFormat = "%host %other %logname %time1 %methodurl %code %bytesd %other %refererquot %uaquot"

Tell awstats the name of your website

Next setting to change with awstats is the name of your website.
So, change this option :


with the name of you web site, we will use here :

so edit the line with :


Disable dns resolution in your reports

As dns resolution can take a lot of time, and it isn't really usefull sometimes, you can choose to disable it.
So, change this line :


to this one :


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License