Archive for May, 2007

Using LogParser to see how many people are subscribed to your feeds

Thursday, May 31st, 2007

LogParser can search through more than just the IIS access logs, but it is particularly good at it. There seems to be an ad-hoc standard to put the number of subscribers into the User-Agent of tools grabbing RSS feeds, like this:

Feedfetcher-Google;+(+http://www.google.com/feedfetcher.html;+32+subscribers;+feed-id=15634587418064760796)

Not everyone has caught onto the standard of putting ‘;’ after the initial name though – so it can be a little tough to isolate them right now. Hint: NewsGatorOnline. Some are not adding subscriber numbers yet (BlogPulseLive) and Yahoo is a little different from everyone else, with the word ‘users’ instead of ‘subscribers’ for YahooFeedSeeker. Come on, Yahoo! get with the program.

Sql wonks can refine this, but it does the job for me:

logparser -i:IISW3C “select substr( substr(cs(user-agent), sub( index_of( cs(user-agent), ‘+subscriber’), 5), 5), add( index_of( substr(cs(user-agent), sub(index_of(cs(user-agent), ‘+subscriber’), 5), 5), ‘;+’), 2), 5), substr(cs(user-agent), 0, index_of(cs(user-agent), ‘;’)) as agent from ex070530.log where cs(user-agent) like ‘%%subscriber%%’ group by cs(user-agent) ” -q:ON -stats:OFF

Produces the number of subscribers, followed by the shortened user-agent:

32 Feedfetcher-Google
11 Bloglines/3.1+(http://www.bloglines.com
7 Feedfetcher-Google
12 NewsGatorOnline/2.0+(http://www.newsgator.com

Add your SqlParser script to a scheduled task, to create a graph, and wow your friends. Well, maybe they won’t be wow-ed. They might have other things to say, especially if your numbers are as low as these. Or they’ll tell you to get back to work.
References
http://www.microsoft.com/technet/scriptcenter/tools/logparser/default.mspx