Site Referrers Utility

Hacked together a little PHP command line tool for extracting HTTP referer (sp – but not mine ;) data from Apache log file. Might be useful for people hosting with TextDrive, or other hosts that don’t have a stats UI built in. The data returned shows, for each referrer URL, the total number of accesses and date of the last one.

To install, download get_referer.tar.gz and unpack it in your log files’ directory. Make get_referer.php and referers executable.


1. Get referrer stats from current access log:

./get_referers.php access_log

2. Get referrers stats overall:

(gunzip -c access_log.*.gz ; cat access_log) | ./get_referer.php

(This line is included in the tar also, in the referers file)

3. Get referrers stats for 2006:
(gunzip -c access_log.2006*.gz ; cat access_log) | ./get_referer.php

And so on…

Hopefully would be useful for someone out there ;)