I wanted a comprehensive log analyzer application for my httpd server and AWStats is a fantastic package for just such a need! Getting it deployed on my Slicehost image was an entirely simple task, but I thought I’d post the instructions for anyone else who may need to do the same.

It goes a little something like this (performed on the image instance, obviously):

1
2
3
4
5
6
7
me@foo: cd /usr/local
me@foo: sudo mkdir awstats
me@foo: sudo wget http://path-to-latest-awstats-package
me@foo: sudo unzip awstats.zip -d awstats; cd awstats
me@foo: sudo chown -R apache:apache wwwroot
me@foo: cd tools
me@foo: sudo ./awstats_configure.pl

Here, follow the prompts, filling in the various configuration items as needed. A new config file will be placed under /etc/awstats. We’ll assume the website is foo.com and the configuration section created is also called foo.com.

8
9
me@foo: cd /etc/awstats
me@foo: vim awstats.foo.com.conf

You’ll need to make some path changes here, most likely. I had to change the LogFile path on line 52. I also removed localhost from the HostAliases on line 146.

Next, I modified my httpd.conf file to include the path to the cgi-bin folder for AWStats within the virtual directory for which I created the AWStats configuration:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Directives to allow use of AWStats as a CGI
Alias /awstatsclasses "/usr/local/awstats/wwwroot/classes/"
Alias /awstatscss "/usr/local/awstats/wwwroot/css/"
Alias /awstatsicons "/usr/local/awstats/wwwroot/icon/"
ScriptAlias /awstats/ "/usr/local/awstats/wwwroot/cgi-bin/"
# This is to permit URL access to scripts/files in AWStats directory.
<Directory "/usr/local/awstats/wwwroot">
   AddHandler cgi-script pl
   Options +ExecCGI
   AllowOverride Options
   Order allow,deny
   Allow from all
   AuthType Basic
   AuthName "Private"
   AuthUserFile /usr/local/apache2/conf/htusers
   Require valid-user
</Directory>

You can see here that I require authentication to see my stats. You may or may not want to do this; if not, just don’t include the lines between “Allow from all” and “</Directory>”.

Now, assuming everything is configured correctly, all that remains is to generate your first set of reports, then gracefully restart your web server:

10
11
12
me@foo: cd /usr/local/awstats/wwwroot/cgi-bin/
me@foo: sudo perl awstats.pl -update -config=foo.com
me@foo: sudo apachectl graceful

Substitute foo.com with the name of your configuration. With that, just point your browser to http://foo.com/awstats/awstats.pl?config=foo.com and see the glorious stats in all of their shining glory before you!

Note: If you only have a single awstat configuration, you can leave off the ?config=foo.com portion of the URL.

Finally, I installed a cron task to generate reports hourly.

I hope this helps. I’m always looking for suggestions or constructive criticism, so please feel free to leave a comment :) Enjoy!

Share with Peeps:
  • Google Bookmarks
  • Digg
  • Reddit
  • del.icio.us
  • Facebook
  • MySpace
  • Live
  • StumbleUpon
  • Technorati
  • TwitThis
  • LinkedIn
  • Pownce

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

Comments are closed.