Another quick post for this one. I just wanted to point out a very useful program called visitors that I came across lately. Visitors is an awesome command line web log analyser created by the same people who made hping.

On a lot of my web servers I don’t have AWStats or Webalizer installed as clients use Google Analytics or other solutions. Normally that stats don’t concern me unless I am doing SEO but occasionally its useful to be able to check the number of visitors to a site within the month to see if it warrants upgrading the server e.t.c.

Visitors can generate both text and html output after parsing the logs. The output for both is really customisable and is well documented on the projects documentation page.

Since on all my servers I run vlogger ( a very good virtual web logfile rotater/parser ) its easy to run visitors against a specific host. Using the following.

visitors -o text -Y /var/www/apache2/pablumfication.co.uk/*.log | less

The ‘-o’ option specifies the output format which can either be HTML or text. HTML is the default so in this case I change it to text as I want to output shown on the commandline.

The ‘-Y’ option specifies theĀ  generation of a report that shows the percentage of pages viewed per unique visit.

This will give output like this

Statistics generated with VISITORS version 0.7
http://www.hping.org/visitors for more information

=== General information ===
--- Information about analyzed log files
--- Generated: Fri Sep 24 00:03:02 2010

* Number of entries processed: 304989
* Number of invalid entries: 0
* Processing time in seconds: 4

... TRUNCATED ... 

=== Unique visitors in each month ===
--- Multiple hits with the same IP, user agent and access day, are considered a single visit
* Number of unique visitors: 16696
* Different months in logfile: 8
   Feb/2010    : 687       |########                                     4.1%
   Mar/2010    : 744       |#########                                    4.5%
   Apr/2010    : 1450      |##################                           8.7%
   May/2010    : 1835      |#######################                      11.0%
   Jun/2010    : 2373      |#############################                14.2%
   Jul/2010    : 3322      |#########################################    19.9%
   Aug/2010    : 3508      |############################################ 21.0%
   Sep/2010    : 2777      |##################################           16.6%

... TRUNCATED ... 

Statistics generated with VISITORS version 0.7
http://www.hping.org/visitors for more information

Another useful one is to read all the access logs on the server so you can get stats for all the hosts in one go.

visitors -o text -Y /var/log/apache2/*/*-access.log | less

That’s my very brief overview of vistors for more details see the projects documentation page. As usual any questions please leave a comment or send me an email.

Share this post

Leave a Reply

CAPTCHA (required) Time limit is exhausted. Please reload CAPTCHA.