Thursday, December 01, 2005

mod_clicktrack: Podcast Feed Tracker for Apache

Ok, first release is ready. It will track your feeds based on a file matching pattern (*.mp3|*.ogg|*.wma), etc. I have successfully done some limited load testing, pounding through 200 hits at once, but it still needs testing I'm sure. However, it is extremely simple. If this is all feedburner is doing it is no big deal. I'm not sure it will compete with feedburner but Todd wanted this alternative, so here it is:

Need to do four things to use it:

1) install the module - This is simply a matter of copying the shared library
file into the, typically, /usr/lib/apache/modules
direction and then reloading apache 'apache2ctl -k restart'.

2) drop a .htaccess text file into the directory with your mp3 files
containing the following substituting your own database login info:

ModuleTrackPattern "*.mp3|*.ogg"
ModuleDSNString "username:passw0rd@localhost/clicktrack:3306"

3) run the following sql on your MySQL database:

`id` int(11) NOT NULL auto_increment,
`uri` varchar(255) NOT NULL default '',
`date` timestamp NULL default CURRENT_TIMESTAMP,
`ip` varchar(15) NOT NULL default '',
`data` varchar(255) NOT NULL default '',
KEY `ua` (`ip`),
KEY `uri` (`uri`)

4) Write some PHP or other scripting code to retrieve the data. For example:

$sql = "SELECT COUNT(*) FROM log WHERE uri LIKE '%.mp3'";
$rs = $db->Execute($sql);
print("Total MP3s Served: ". $rs->fields[0]);

I will be starting have started yet another sourceforge project to house the code and package downloads. In addition I plan to write an install script to help with the setup and configuration.

It is setup as an Eclipse, 'managed GNU C make' project. You can certainly write your own makefile or use apxs2 to install it.

Get the package here containing source and binaries optimized for Pentium 4 and dynamically linked to mysqlclient library. at sourceforge.


Blogger Andy Armstrong said...

What does this do that can't be achieved by analysing log files? I've had a look at the source and all it seems to do is log to a database. Am I missing something?

Fri Dec 02, 09:10:00 AM CST  
Blogger CBlackburn said...

Andy, you are correct. That's all it does. It is very simple. The only think different, I believe, is that it allows one to filter out all but the specific type of requests that are of interest.

Fri Dec 02, 10:30:00 AM CST  

Post a Comment

<< Home