A running Apache server logs snapshot Print E-mail
Written by machiner   
Tuesday, 09 January 2007 18:31
Here I was bored for a few seconds. I think it was the comments to some article on [[Slashdot]] that I was reading that started me to thinking about yet another way to interpret my web-logs. There are many options, you've heard of most, no doubt. My web host gives me [[Awstats]] and [[Webalizer]] and I get some good info from them both. Of course, this can be argued, but you get the point. I really liked Sawmill, but it's too expensive. Normally I use AXS Visitor Tracking for daily stuff. But I was bored.

I started looking around the web for yet another log reader. Nothing fancy, just Apache logs. All of them can read Apache style logs. I had as much time as I needed, all 5 minutes of it, so there was no hurry. I found Visitors web-logs analyzer pretty quickly.

It fit the bill.

  • No install necessary and I like that.
  • small footprint
  • free
  • fast

I downloaded then extracted the files. Quick cd into the directory, run

$ visitors --help

so I know what some options are, and I'm good. It's so easy that I can do it. Utilities rock.

Here is what I do to get some quick running stats on the visitors to debiantutorials.org at any time. It's so easy...

First I download my logs using wget, like so:

wget -P /your/save/to/directory ftp://uname: This e-mail address is being protected from spambots. You need JavaScript enabled to view it /../../logs/server-logs.log

Looking at the command we can surmise the following:

The place that I save my log file to is before the place that I get my log file from in the wget command. This is common.

There are dots and slashes following my domain. This is because my log file is in a directory 2 levels "up" from my web root. ../ means go up one directory.

Open a terminal and type:

$ cd ../

See?

And finally, you notice how simple the terminal is. Not to mention fast.

Now that I have my log file I cd into the directory that I downloaded it to. Then, and I learned this from running visitors with the --h option, I parsed my log file

$ visitors -A server-logs.log > visitors.html

Takes one (1) second to parse my 10 some-odd MB file from today. That's cool. Like I said -- it doesn't give me all that much. It gives me exactly what I want to see. So, I double-click on the visitors.html file that was just made and Opera fires-up with a page showing me my stats from the day up to just a minute ago.

You may not think it right away but this whole process takes 2 seconds longer than the amount of time necessary to wget my log file. It was 10MB and on a fast connection, that only takes a couple of minutes.

--machiner 9 Jan 07

Last Updated on Sunday, 09 March 2008 05:27