1) With Apache Server (on Unix/Linux, Windows, MacOS...)
* Configure your apache web server to have NCSA combined/XLF/ELF log format (you can use your own log format but
this predefined logformat is often the best choice and made setup easier). You can do this by changing, in httpd.conf,
following directives (See your apache manual for more information): CustomLog /yourlogpath/yourlogfile common
into CustomLog /yourlogpath/yourlogfile combined
To be sure the log format change is effective, you can stop Apache, remove all old log files, restart Apache and go to
your homepage. This is an example of records you should get then in the new log file: 62.161.78.75 - - [dd/mmm/yyyy:hh:mm:ss +0000] "GET / HTTP/1.1" 200 1234 "http://www.from.com/from.html" "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"
* Copy all the content of provided AWStats cgi-bin directory into your web
server cgi-bin directory (this includes awstats.pl, awstats.model.conf, and the lang and lib sub-directories).
* If necessary (should not with most perl interpreter), in awstats.pl file, edit the first line #!/usr/bin/perl
to reflect the path were your perl interpreter is installed.
Default value works for most of Unix OS, but it also might be #!/usr/local/bin/perl
With Apache for Windows and ActivePerl interpreter, it might be #!c:/program files/activeperl/bin/perl
* Move all AWStats icon sub-directories into a directory readable by your
web server, for example /yourwwwroot/icon or /yourwwwroot/icons.
* Copy awstats.model.conf into awstats.virtualhostname.conf (or awstats.conf).
Note: When you will run AWStats, it will first look for a config file named
awstats.virtualhostname.conf, and, if not found, will look for awstats.conf.
Whatever the name you choose, this new file must be stored in
- /etc/opt/awstats or /etc/awstats or /etc or same directory than awstats.pl (so cgi-bin) for Unix/Linux users.
- same directory than awstats.pl (so cgi-bin) for Windows and other OS.
Edit this new config file with your own setup :
- Change LogFile value with full path of your web server log file (You
can also use a relative path from your awstats.pl directory).
- Check if LogFormat has the value "1" (it means "NCSA apache combined/ELF/XLF log format").
- Change DirIcons parameter to reflect relative URL of icon directory.
- Edit SiteDomain parameter with the main domain name or the intranet
web server name used to reach the web site to analyze.
- You can change other parameters if you want.
* Configure IIS to log in "Extended W3C log format" (You can still use
your own log format but setup is easier if made like suggested). So, for
this, start the IIS Snap-in, select the web site and look at its
Properties. Choose W3C Extended Log Format, then Properties, then the
Tab Extended Properties and uncheck everything under Extended Properties.
Once they are all unchecked, check all following fields:
date
time
c-ip
cs-username
cs-method
cs-uri-stem
sc-status
sc-bytes
cs-version
cs(User-Agent)
cs(Referer)
To be sure the log format change is effective, you must stop IIS, remove all old log files, restart IIS and go to
your homepage. This is an example of records you should get then in the new log file: 2000-07-19 14:14:14 62.161.78.73 - GET / 200 1234 HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+5.01;+Windows+NT+5.0) http://www.from.com/from.htm
* Copy all the content of provided AWStats cgi-bin directory into your web
server cgi-bin directory (this includes awstats.pl, awstats.model.conf, and the lang and lib sub-directories).
* Move all AWStats icon sub-directories into a directory readable by your
web server, for example C:\yourwwwroot\icon.
* Copy awstats.model.conf into awstats.virtualhostname.conf (or awstats.conf).
Note: When you will run AWStats, it will first look for a config file named
awstats.virtualhostname.conf, and, if not found, will look for awstats.conf.
Whatever the name you choose, this new file must be stored in
- same directory than awstats.pl (so cgi-bin)
Edit this new config file with your own setup :
- Change LogFile value with full path of your web server log file (You
can also use a relative path from your awstats.pl directory).
- Change LogFormat to value "2" (it means "IIS Extended W3C log format").
- Change DirIcons parameter to reflect relative URL of icon directory.
- Edit SiteDomain parameter with the main domain name or the intranet
web server name used to reach the web site to analyze.
- You can change other parameters if you want.
Even if AWStats allows "real-time" statistics with its "update from browser feature" (See next
section Read Statistics), you must run the update process from a scheduler frequently.
* The first update of statistics can be made the first time manually from the command line (the first time,
process may be long : awstats.pl -config=virtualhostname -update
AWStats will read the config file (awstats.virtualhostname.conf, or, if not found, awstats.conf)
and create/update its database with all summary information issued from analyzed log file.
AWStats database files are saved in directory defined by DirData parameter in config file.
When update is finished, you should get a result like this: Lines in file: 225730
Found 5 dropped records,
Found 124 corrupted records,
Found 0 old records,
Found 225601 new records.
Dropped records are records discarded because they were not user HTTP request or requests were not qualified
by AWStats filters (See SkipHosts, SkipFiles,
and OnlyFiles parameters).
If you want to see which lines were dropped, you can add the -showdropped option on command line. Corrupted records are records that does not match log format defined by "LogFormat" parameter in AWStats config/domain file.
With all webservers you can experience a little bit corrupted records (<5%) even when everythings work correctly.
This can be the result of several reasons: Web server internal bugs, bad requests made by buggy browsers, web server brutal stop...
If all your lines are corrupted and "LogFormat" parameter in AWStats config/domain file is correct, it may be the log
format setup in your web server that is wrong. Don't forget that you "LogFormat" parameter in AWStats config/domain
file MUST match the log file format you analyze.
If you want to see which lines are corrupted, you can add the -showcorrupted option on command line. Old records are simply records that were already processed by a previous update process. So it's not necessary to
purge your log file after each update process even if it's HIGHLY recommended to do it as soon as possible. New records are records in your log file that were successfully used to build/update statistics.
Note : A log analysis process is slow (one second for each 4100 lines of your
logfile with Athlon 1Ghz, plus DNS resolution time for each different IP
address in your logfile if DNSLookup is set to 1 and not already done in your log file).
See Benchmark page for more accurate information.
* Then new updates should be made from an automatic process.
You can add instructions in your crontab (Unix/Linux) or your task scheduler (for
Windows), to launch frequently this Awstats update process.
For sites with:
- 10,000 visitors a month Launch AWStats once a day
- 50,000 visitors a month Launch AWStats once every 4 hours
- 250,000 visitors a month Launch AWStats once an hour
- 1,000,000 visitors a month Launch AWStats once an hour
This is ABSOLUTELY necessary to keep good performances.
See AWStats Benchmark page for more accurate information.
!!! Warning, if you don't use (or can't use with IIS) the PurgeLogFile parameter,
it's very important that you don't forget to purge/rotate your log file yourself (or setup your web server to do it)
frequently. Even if AWStats never analyzes twice the same log record, the more often you clean your log file, the
faster AWStats will be.
To see results of analyze, you have several solutions depending on your security policy.
* You can build the main report, in a static HTML page, from the command line, like this : awstats.pl -config=virtualhostname -output -staticlinks > awstats.virtualhostname.html
You can also use all other output options (each of them give you another report).
This is how to use all other possible output options: awstats.pl -config=virtualhostname -output=allhosts -staticlinks > awstats.virtualhostname.allhosts.html awstats.pl -config=virtualhostname -output=lasthosts -staticlinks > awstats.virtualhostname.lasthosts.html awstats.pl -config=virtualhostname -output=unknownip -staticlinks > awstats.virtualhostname.unknownip.html awstats.pl -config=virtualhostname -output=urldetail -staticlinks > awstats.virtualhostname.urldetail.html awstats.pl -config=virtualhostname -output=urldetail:filter -staticlinks > awstats.virtualhostname.urldetailfiltered.html awstats.pl -config=virtualhostname -output=browserdetail -staticlinks > awstats.virtualhostname.browserdetail.html awstats.pl -config=virtualhostname -output=unknownbrowsers -staticlinks > awstats.virtualhostname.unknownbrowsers.html awstats.pl -config=virtualhostname -output=unknownos -staticlinks > awstats.virtualhostname.unknownos.html awstats.pl -config=virtualhostname -output=refererse -staticlinks > awstats.virtualhostname.refererse.html awstats.pl -config=virtualhostname -output=refererpages -staticlinks > awstats.virtualhostname.refererpages.html awstats.pl -config=virtualhostname -output=keyphrases -staticlinks > awstats.virtualhostname.keyphrases.html awstats.pl -config=virtualhostname -output=keywords -staticlinks > awstats.virtualhostname.keywords.html awstats.pl -config=virtualhostname -output=errors404 -staticlinks > awstats.virtualhostname.errors404.html
Note: If you prefer, you can use awstats_buildstaticpages tool to
build all those pages in one command.
* You can also view dynamically your statistics from a browser.
If you named your config file awstats.virtualhostname.conf, use URL: http://www.myserver.mydomain/cgi-bin/awstats.pl?config=virtualhostname
where virtualhostname is used to know which config file to use (AWStats
will use awstats.virtualhostname.conf file).
If you named your config file awstats.conf, just use URL: http://www.myserver.mydomain/cgi-bin/awstats.pl
Note: If AllowToUpdateStatsFromBrowser parameter is set to 1 in AWStats config/domain file,
you will also be able to run the update process from your browser. Just click on link "Update now".