Why? #
because server stats are important… #
The quality of your website also happens to depend on the number of mistakes they have. A professional website is supposed to have less dead links for example. Search engines use information like this to rank your site. It is also good to know which specific pages are the most frequently visited on your site:
- optimize your content to fit the expectations of your audience
- never ever delete a page which is frequently visited, also known as the Cool URIs don't change-rule.
and compared to other tools… #
Compared to the popular and fast webalizer, which is written in C and requires little dependencies awstats has a few advantages:
- displays a list of
error 404: file not found
, so it can be used to locate dead links (my personal killer feature in this comparison) - is written in perl and is expandable via perl modules. Perl is a good choice since regular expressions are a language feature and can easily be used
- looks nicer and can be further tweaked by using plugins
- better maintained
How? #
Under FreeBSD files are typically located under
/usr/local/www/awstats/
. Depending on the webserver you use this
location does not really matter when aliases are used.
Configuration #
A minimalistic configuration might look like this...
- step 1
- Take the model file as an example for an configuration and cusomize the following 5-6 lines:
- and save the file the file in that cgi-bin-folder and under a new name, but use the form
# /usr/local/www/awstats/cgi-bin/awstats.model.conf LogFile="/var/log/lighttpd/access.log" LogFormat=1 SiteDomain="entwicklerseite.de" HostAliases="localhost 127.0.0.1 www.entwicklerseite.de blog.entwicklerseite.de" DirData="/usr/local/www/logs/entwicklerseite.de/DirData/" CreateDirDataIfNotExists=1
awstats.[entwicklerseite.de].conf
or it will not work. - step 2
- create the directory for incrementall data (that way the stats can be updated more quickly):
mkdir /usr/local/www/logs/entwicklerseite.de/ chown www:www /usr/local/www/logs/entwicklerseite.de/
- step 3 (optional)
-
visit your stats and update them
-
visit
[entwicklerseite.de]/awstats/awstats.pl?config=[entwicklseite.de]
. That way you can use one installation to log all your subdomains for example by providing a config file for each of those. - step 4 (optional)
-
use a cron job to update your stats
-
# update all stats... /usr/local/www/awstats/tools/awstats_updateall.pl -awstatsprog=/usr/local/www/awstats/cgi-bin/awstats.pl -configdir=/usr/local/www/awstats/cgi-bin/ now
and restart cron with
/etc/rc.d/cron restart
Troubleshooting #
- No stats: Every digit is a
0
-
This has propably to do with the
LogFormat
you specified. It is annoying, but is has to match exactly the number of fields per line -
Execute
/usr/local/www/awstats/cgi-bin/awstats.pl -config=entwicklerseite.de
from the shell and see what it says.
Known log formats #
- 1&1
LogFile="/usr/local/bin/perl /usr/local/www/awstats/tools/logresolvemerge.pl /usr/local/var/log/wireme.de/access.log.* |" LogFormat="%host %other %logname %time1 %methodurl %code %bytesd %virtualname %refererquot %uaquot %other"