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 full path to your config file. Here's an example of parsing
44 the all the archived logs (my logs are archived as
45 `access_log-YYYYMMDD.gz`):
47 $ for log in example-logs/access_log-*.gz; do awstats.pl -config="${PWD}/awstats.example.conf" -LogFile="gzip -cd ${log} |"; done
49 I also analyze logs from another host, whose logs are archived weekly
50 as `access_log.2.gz`, `access_log.3.gz`, etc. To parse the last year
51 of those archived logs, use something like:
53 $ for i in $(seq 52 -1 2); do awstats.pl -config="${PWD}/awstats.example.conf" -LogFile="gzip -cd example-logs/access_log.${i}.gz |"; done
55 After working through the archived logs, you can process the current
58 $ awstats.pl -config="${PWD}/awstats.example.conf"
60 Once all the logs have been processed, run
62 $ awstats.pl -config="${PWD}/awstats.example.conf"
64 To generate the report, run
66 $ awstats.pl -config="${PWD}/awstats.example.conf" -output
68 [AWStats]: http://www.awstats.org/