Extract Distinct restful MVC routes from IIS logs

Posted by Grummle on Server Fault See other posts from Server Fault or by Grummle
Published on 2012-05-31T15:25:46Z Indexed on 2012/05/31 16:42 UTC
Read the original article Hit count: 252

Filed under:
|
|
|

This is a cross post from StackOverflow that after some consideration I believe can be asked here (not getting anything on SO).

My shop is using MVC3/FUBU on IIS 7. I recently put something into production and I wanted to gather metrics from the IIS logs using log parser. I've done this many times before with file endpoints but because the MVC3 routes are of the form /api/person/{personid}/address/{addressid} the log saves /api/person/123/address/456 in the uristem column.

Does anyone have any ideas on how to get data about specific routes from IIS logs?

As an exmaple: Log Like this:

cs-uri-stem
/api/person/123/address/456
/api/person/121/address/33
/api/person/3555
/api/person/1555/address/5555

I want information about all where the route used was /api/person/{personid} so the count would be 1 in this case.

Ideally what I'd like to figure out is how to do is is have IIS log the regex for the route that is choose for a particular url. So in the IIS logs have /api/person/{personid}/address/{addressid} in a column in addition to the cs-uristem /api/person/1555/address/5555

© Server Fault or respective owner

Related posts about iis7

Related posts about logging