1 [AWStats][] is a log analyzer that gives you nice summaries about
2 who's accessing your web server, when they're accessing it, how much
3 bandwidth they're using, etc. Here's a quick run through installing
4 and using AWStats on [[Gentoo]].
10 Optionally, copy the log files from a remote server:
12 $ rsync -avz example.net:/var/log/apache2/ example-logs/
14 Configure AWStats by adjusting the model configuration distributed
17 $ cp /etc/awstats/awstats.model.conf awstats.example.conf
18 $ emacs awstats.example.conf
20 Here's an example config with the options I use:
22 # AWSTATS CONFIGURE FILE 7.0
23 Include "awstats.user.conf.common"
24 LogFile="example-logs/access_log"
28 SiteDomain="www.example.net"
29 HostAliases="localhost 127.0.0.1 REGEX[example\.net$]"
32 CreateDirDataIfNotExists=1
33 DirIcons="/usr/share/awstats/wwwroot/icon"
34 BuildHistoryFormat=text
35 LoadPlugin="decodeutfkeys"
37 LoadPlugin="hashfiles"
39 Because `awstats.pl` can be invoked interactively through your browser
40 (depending on how you have it installed), it has a fairly restricted
41 path. In order to run awstats on files in a random directory
42 (e.g. for processing your server's logs on another host) you should
43 use the `-configdir` option. Here's an example of parsing the all the
44 archived logs (my logs are archived as `access_log-YYYYMMDD.gz`):
46 $ for log in example-logs/access_log-*.gz; do awstats.pl -configdir="${PWD}" -config example -LogFile="gzip -cd ${log} |"; done
48 I also analyze logs from another host, whose logs are archived weekly
49 as `access_log.2.gz`, `access_log.3.gz`, etc. To parse the last year
50 of those archived logs, use something like:
52 $ for i in $(seq 52 -1 2); do awstats.pl -configdir="${PWD}" -config=example -LogFile="gzip -cd example-logs/access_log.${i}.gz |"; done
54 After working through the archived logs, you can process the current
57 $ awstats.pl -configdir="${PWD}" -config=example
59 Once all the logs have been processed, run
61 $ awstats.pl -configdir="${PWD}" -config=example -update
63 To generate the report, run
65 $ awstats_buildstaticpages.pl -configdir="${PWD}" -config=example -dir=html
67 [AWStats]: http://www.awstats.org/