AWStats
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
AWStats http://awstats.sourceforge.net/ Goal: Install AWStats 5.9 on a Sun Cobalt server and configure to auto generate reports for all virtual domains hosted on the server. Note: Also tested on FreeBSD 4.9-RELEASE with AWStats 6.1 1. Verify Apache version ... > httpd -v Server version: Apache/1.3.20 Sun Cobalt (Unix) Server built: Jul 23 2001 14:55:10 On FreeBSD used: > /www/apache/bin/httpd -v Server version: Apache/1.3.26 (Unix) Server built: Aug 27 2002 01:38:46 2. Verify shared module support ... > httpd -l Compiled-in modules: http_core.c mod_so.c mod_perl.c suexec: enabled; valid wrapper /usr/sbin/suexec On FreeBSD: >/www/apache/bin/httpd -l Compiled-in modules: http_core.c mod_so.c suexec: disabled; invalid wrapper /www/apache/bin/suexec In both cases we're looking for the presence of mod_so.c 3 . Download and unpack AWStats software ... > cd /root > mkdir archive > cd archive > wget http://unc.dl.sourceforge.net/sourceforge/awstats/awstats-5.9.tgz FreeBSD was missing the wget command so I did the download like this: > lynx -source http://unc.dl.sourceforge.net/sourceforge\ /awstats/awstats-6.1.tgz > awstats-6.1.tgz Now unpack the distribution: > tar -xvzf awstats-5.9.tgz > cd awstats-5.9 or on FreeBSD: > tar -xvzf awstats-6.1.tgz > cd awstats-6.1 4. Install AWStats software ... > mv wwwroot /home/awstats > cp tools/awstats_buildstaticpages.pl /home/awstats/cgi-bin 5. Install run script ... > cd /root/archive > wget http://www.reliablepenguin.com/clients/misc/awstats.run.pl or on FreeBSD: > lynx -source http://www.reliablepenguin.com/\ clients/misc/awstats.run.pl > awstats.run.pl You might need to edit this script and adjust the SITE_BASE variable to match your install. On FreeBSD the path to grep had to be changed to /usr/bin/grep at the start of the script. Next do: > chmod 755 awstats.run.pl > cp awstats.run.pl /usr/local/sbin 6. Install config template ... > cd /home/awstats/cgi-bin > wget http://www.reliablepenguin.com/clients/misc/awstats.template.conf or on FreeBSD: > lynx -source http://www.reliablepenguin.com/\ clients/misc/awstats.template.conf > awstats.template.conf The template config file sets the following: LogFile="/home/sites/#SITE#/logs/web" LogType=W LogFormat=1 SiteDomain="#SITE#" DNSLookup=0 DirCgi="/awstats/cgi-bin" DirIcons="/awstats/icon" For FreeBSD the template must be edited to set the following: LogFile="/www/logs/#SITE#-access.log" 7. Setup apache .... Edit /etc/httpd/conf/httpd.conf and add the following lines to the end of the file just before any virtual definitions: Alias /awstats/icon /home/awstats/icon Alias /awstats/js /home/awstats/js Alias /aswtats/css /home/awstats/css On FreeBSD the httpd.conf file is located in /usr/www/apache/conf/ 8. Setup logrotate ... Edit /etc/logrotate.d/apache and add the indicated line. /var/log/httpd/access { prerotate /usr/local/sbin/split_logs web < /var/log/httpd/access ADD --> /usr/local/sbin/awstats.run.pl >> /var/log/awstats.log endscript missingok postrotate /usr/bin/killall -HUP httpd 2> /dev/null || true endscript daily } The logrotate setup was not needed on the FreeBSD server. Instead a cronjob did the trick. That does it! Notes: Basic awstats operations: a. Initialize the database with logs ... > /awstats.pl -config=your.domain -update b. Run reports ... > /home/awstats/cgi-bin/awstats_buildstaticpages.pl \ -config=your.domain \ -dir=/home/sites/your.domain/web/awstats/reports \ -awstatsprog=/home/awstats/cgi-bin/awstats.pl |