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.

Usage:

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 ;)

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s