Cool stats with awstats

Posted by Pat Tue, 24 Jan 2006 06:30:00 GMT

There was a post on the Rails list the other day about installing awstats on lighttpd. If you don’t know, awstats is a log analyzer tool that runs through your web server logs and generates cool stats. Since I want to see how much traffic I’m (not) getting, I figured I’d install it. Should be a breeze, because I’m using FreeBSD :)

cantona# cd /usr/ports/www/awstats/
cantona# make install clean

Now awstats is installed to /usr/local/www/awstats/. Follow the instructions on the link above to finish..took me about 5 minutes. I’d like to see if somehow I can make stats.mydomain.org automatically append the config for the incoming hostname. That sure would be sweet..might have to hack the script up a little bit.

Tip: In your lighttpd config file, you may have virtual hosts set up with something like:

$HTTP["host"] =~ "(www\.)?mydomain\.com"

I was stumped for a minute because it kept matching “stats.mydomain.com” when I didn’t think it should. Anyway, since it’s using Perl pattern matching, the key is to make sure that you check to see that the domain starts with that, which you do using ^:

$HTTP["host"] =~ "^(www\.)?mydomain\.com"

Pretty simple..regular expressions sure are fun.

Posted in ,  | Tags ,  | 2 comments

Comments

  1. shane said 1 day later:

    The FreeBSD port puts the icons needed for the program in a directory called ‘icons’. Yet the Perl script looks for ‘awstatsicons.’ So if you want meaningful data from the graphs, either fix the path in the awstats.pl script or rename the ‘icons’ directory.

    Or you can set the icon folder location in the config file, ie: DirIcons=”/icons”.

  2. Pat said 2 days later:

    There’s a much easier way :)

(leave url/email »)

   Preview comment