User Tools

Site Tools


Action disabled: source
blog:configure_awstats_on_debian_webserver

Configure awstats on debian webserver

AWStats on Debian

Install AWStats

aptitude update
aptitude awstats

Configure the apache2 for awstats

Copy configuration file for apache2.

cp /usr/share/doc/awstats/examples/apache.conf /etc/apache2/conf.d/awstats

Then edit /etc/awstats/awstats.conf file and make sure the file contains (double check the apache2 word)

LogFile="/var/log/apache2/access.log"
SiteDomain="mysite.org"
LogFormat=1

Now change a permission on apache log file

chmod o+r /var/log/apache2/access.log

Make it a default that access.log has these permissions.

Locate the awstats_updateall.pl script (it is in /usr/share/doc/awstats/examples on debian) and make a symlink to /usr/local/bin for it.

Edit the /etc/logrotate.d/apache2 and make sure it has these lines

create 644 root adm
prerotate
      nice /usr/local/bin/awstats_updateall.pl -awstatsprog=/usr/lib/cgi-bin/awstats.pl now                                                                                     
endscript

Final file should look similar to :

/var/log/apache2/*.log {
        weekly
        missingok
        rotate 52
        compress
        delaycompress
        notifempty
        create 644 root adm
        sharedscripts
        prerotate
           nice /usr/local/bin/awstats_updateall.pl -awstatsprog=/usr/lib/cgi-bin/awstats.pl 
        postrotate
                if [ -f /var/run/apache2.pid ]; then
                        /etc/init.d/apache2 restart > /dev/null
                fi
        endscript
}

Add the update command to cron.hourly:

nice /usr/local/bin/awstats_updateall.pl -awstatsprog=/usr/lib/cgi-bin/awstats.pl 

Reload apache

/etc/init.d/apache2 reload

And visit:

http://localhost/cgi-bin/awstats.pl?config=awstat.conf or http://www.mysite.com/cgi-bin/awstats.pl?config=awstat.conf [Optional]

To make it easier to remember the address you can edit /etc/apache2/conf.d/awstats and add this line.

RedirectMatch ^/logs /cgi-bin/awstats.pl

Now you can access the awstats statistics by going to

http://www.mysite.com/logs

If you have a lot of old compressed logfiles that you would to include, set the logfile path to:

LogFile="zcat /var/log/apache2/servername.tld-access.log.*.gz |"

And update the database. This will incorporate all old log entries. Don't forget to switch back to the last logfile!

Ref: http://wiki.debian.org/Manual-Howto

~~LINKBACK~~

Discussion

Enter your comment. Wiki syntax is allowed:
 __  __  __  __     __  _____   ___ 
 \ \/ / / / / / __ / / / ___/  / _ |
  \  / / /_/ / / // / / /__   / __ |
  /_/  \____/  \___/  \___/  /_/ |_|
 
blog/configure_awstats_on_debian_webserver.txt · Last modified: 2010-10-24 10:29 by brb