Smartlab Software logo

AWStats: Set up the Config File

AWStats logo The AWStats config file is explained in this step.


  1. Acquire AWStats, other programs, and pertinent information
  2. Install AWStats on the 1and1 shared server
  3. Install AWStats on your computer
  4. Set up the AWStats config file
  5. Create a usable log file
  6. Create/update the AWStats database
  7. Create a traffic web page
  8. Create report batch files
  9. Analyze the traffic page
  10. Tasks

Extending AWStats

  1. Extras
  2. Geographic Plug-ins
  3. How To


  1. Glossary
  2. FAQ
  3. Pages not found FAQ
  4. Stop Referrer Spam


I do not use the AWStats configuration wizard since it does not cover many of the configuration options and I have several config files.

I have 4 config files for offline reporting and 1 config file for online reporting. The offline config files are for daily, weekly, monthly, and yearly reporting. The single online config file is for today reporting.

  • awstats.daily.conf
  • awstats.weekly.conf
  • awstats.monthly.conf
  • awstats.yearly.conf

DOCROOT - path to your awstats directory on the server
LOCALPATH - path to your awstats directory on your computer
FILELOCALPATH - special path to your AWStat's icon directory. In order to accommodate FireFox I had to put file:/// in front of the LOCALPATH so the icons appear in the static reports. All browsers I tested worked fine.

Config File Differences

The differences are listed below:

daily (offline)


weekly (offline)


monthly (offline)


yearly (offline)


today (offline)


today (online)

LogFile="cat DOCROOT/logs/access.log.??.? |"

Set up the AWStats config file

AWStats uses a configuration file in text format and allows you to analyze any number of subdomains/subdirectories in a given hosting account. uses the config file for its operations. We use several different config files, depending on the timeline or the domain.

For example: In you create a webpage for yourself ( and one for your dog ( You can then configure AWStats to analyze your domain in total or both of your websites (yourself and yourdog) independently. In the latter case you need to create a config-file for each of your web directories (one for and one for

The config files are placed in awstats/wwwroot/cgi-bin/ directory. AWStats comes with a template (awstats.model.conf) which you can copy for each of your subdomains/subdirectories and which you have to edit according to your settings and needs. Rename the middle part of your config files according to your subdomains/subdirectories, e.g. awstats.yourself.conf and awstats.yourdog.conf:

Editing config file

This tutorial will only cover modifications to the config file that are either essential or of general interest, according to the author's opinion. There are many more options not mentioned here which allow you to further customize AWStats. In any case try to understand the modifications rather than just copying and pasting them.

Use a plain text editor, such as Notepad, rather than Word. Word will add a bunch of garbage to the config file.

Use absolute paths instead of relative ones.

The following modifications to the config file need to be done to analyze the 1and1 web server logfiles:

# is for comments in a config file.

Essential Changes


The value will depend on which config file you are creating. The differences are noted

Change to the location of the usable logfile. The 1and1 webserver creates a new logfile daily and adds to it throughout the day. Logfiles before the current one are gzipped (i.e. compressed, as they are very large). At the end of the week the daily logfiles are merged into a weekly logfile.

I suggest updating AWStats once a day, based on the respective zipped logfile created the day before. This will generate less server load than updating more frequently (e.g. on an hourly basis) and no information will be missed around the server's daily change of logfiles.

The location of the logfile as given to AWStats is defined as the piped output of gunzip, which is ordered to unpack the most recent zipped logfile found in the log-directory.



Needs to reflect the log format of the logfiles on the 1and1 webserver. You can look at a logfile in a texteditor to find the following scheme (ignore linebreaks):

LogFormat=%host %other %logname %time1 %methodurl 
					%code %bytesd %virtualname %refererquot %uaquot %otherquot


Enter the main address of the domain/subdomain you want to analyze by this config file. Alternative addresses of your domain can be added under HostAliases (see below).



HostAliases="localhost REGEX[myserver\.com$]"

Add any additional addresses, by which your domain/subdomain can be accessed. You can use regular expressions if you like.



This is where AWStats stores its database and working files.



AWStats can be accessed from the command line to generate static (x)html-reports. Links within these static reports will have their URLs based on the relative or absolute online location of your cgi-bin directory as provided with this setting.



As well as DirCGI this setting will only be used when generating static (x)html-reports. Name the online location of the icon directory (which contains image and icon files to be used in the reports). If you use


For online version I had to use the following. Putting in DOCROOT did not work.



If several of your websites share a domain ( vs. rather than being organized by subdomains use this filter to analyze them individually. To see your own website's statistics only rather than analyzing your dog's hits, too, an adequate regular expression for your config-file would be:




Here we define the index file for our web site. In other words, our home page. This depends on your site.


This is another important directive. Here we set what file extensions will not be counted as Page Views or Downloads, but only as Hits. Usually, this list includes files that are part of a web page (images, stylesheets, flash animations, java applets etc.). I have added many new ones onto the default.

NotPageList="css js class gif jpg jpeg png bmp ico swf zip tgz gz tar rss xml rdf"

Optional changes you may consider:


Unauthorized people should not have access to your webserver statistics. The .htaccess file which is necessary to enforce this will be dealt with later.



Enter your FTP user-name here and follow the instructions under 3.2. This will provide access only to that specific user-account.



Considering the traffic of your website, server load and update speed you might want to fully enable DNS Lookup. Note this will make AWStats run much slower. Note the DNS lookup is to get country information only.

By setting this directive to 0, no reverse DNS lookup requests will be sent to the nameserver. I have set the Apache web server to do these lookups, so a value of 0 is the proper one. You can set this to 1, which will lead to numerous lookup requests to the nameserver, or 2, which will make awstats do the resolving by examining a DNS cache file, if it exists. Keep in mind that having awstats do the reverse DNS lookups will slow the statistics update process dramatically.

It does not seem to work on local report creation.




If the directory configured in DirData does not exist, AWStats will fail, unless you allow for the automatic creation of the directory.




If you wish to be able to manually update AWStats from your browser, you need to change this config and you will not be able to use the $HOME variable in the config file as demonstrated in this tutorial but need to write out the path instead.


Change this option, if you want to be able see statistics for the complete year rather than only for single months while using the browser interface.


It’s a good habit to have awstats keep a backup of the historic data during the update process.



This is a very important directive regarding the accuracy of the statistics. Usually, we are our web site’s most regular visitor and it’s obvious that we do not want to be counted as a visitor. This directive can take IP addresses or hostnames as values, separated with a space. Regular expressions can be used in the form of REGEX[value]. IP addresses cannot be mixed with hostnames, so, if the DNS lookups take place at the web server level, then we have to use hostnames as values, otherwise we have to use IP addresses. Usually we need to set the IPs or hostnames of all our LAN computers or computers we use to edit the website, so that they are ignored. Below are some examples:

SkipHosts="localhost REGEX[^.*\.example\.dyndns\.org$] windowspc1"
SkipHosts=" REGEX[^192\.168\.] REGEX[^10\.]"



If you use any custom spiders or bots to test or analyze your web site, but you don’t want their access to be included in the stats, then you should add their "User Agent String" as a value to this directive. Again, regular expressions can be used in the form of REGEX[value].


These do not need to be modified, unless you want the query string to be included in the web page URLs or Referrer URLs in the traffic reports. Enabling the URLWithQuery directive is important in the case your web page URLs are of the form /index.php?p=10, so that it is clear in the traffic reports which page was viewed. On the other hand, if your page URLs are of the above form, but you use permalinks, then it’s not needed to modify the default values for these directives.
Including the query string in the referrer URLs is not important, in fact it can lead to lengthy meaningless referrer lists, which is not so convenient. I just provide this info here for completeness.


By default, the detection of worms that have crawled your web site is disabled. You may want to enable this by setting the above directive’s value to 2.


If you need the reports to be in a specific language, set it here. A list of supported languages exists in the configuration file.


If your reports are private, you may set this directive’s value to PHBL (details about what each letter represents can be found inside the conf file), so that a section with details about your web site’s authenticated users is included in the reports.


If you had previously enabled the worm detection, then you may want to include a detailed section about worms in the reports.


By setting this to 1, a summary of how many links to another internal page have been followed from your site’s pages is included in the reports.

MaxNbOfDomain = 10
MaxNbOfHostsShown = 10
MaxNbOfLoginShown = 10
MaxNbOfRobotShown = 10
MaxNbOfPageShown = 10
MaxNbOfOsShown = 10
MaxNbOfBrowsersShown = 10
MaxNbOfRefererShown = 10
MaxNbOfKeyphrasesShown = 10
MaxNbOfKeywordsShown = 10

Here follows some info about the reports. You can create only one main page with a summary of the web site’s traffic, but you can also generate some supplemental pages which have full lists of the visited pages, referrers, countries, search engines etc. Each section in the main page includes a predefined number of entries that are displayed. For example, it displays by default the top 10 referrers. This number can be customized by modifying the directives above.


By default, each URL shown in the reports is a clickable hyperlink. If you do not want them to be actual hyperlinks, then set this to 0.


With these directives you set the number of entries each of the supplemental reports can have and if you want these supplemental reports to be opened in a new browser window.


The AWStats package includes some plugins you can enable. I found the above two to be helpful. The first one enables the display of some descriptive tooltips and the second one makes it possible to show keywords and keyphrases correctly using national characters.

There are some other interesting plugins inside the AWStats package, but also some more from other contributors. You can find the latter at the project’s web site. Keep in mind, that each plugin may require certain Perl modules to be installed.

Next: Create Log File