I recently had to analyze how much static data the web server was sending out on a daily basis. We wanted to try to get a sense of what it would cost to host all this static content on the new Amazon Cloudfront CDN (content delivery network).
I knew there had to be something out there, but I didn’t know there was something right in the IIS 6 resource kit called LogParser.
There are a bunch of options in log parser, but the one I thought was way cool was the ability to basically “query” the log. For example:
LogParser “Select count(*), sum(sc-bytes) from d:logsw3svc1ex090922.log where cs-uri-stem like ‘%.jpg’ or cs-uri-stem like ‘%.gif’ or cs-uri-stem like ‘%.swf’ or cs-uri-stem like ‘%.css’ or cs-uri-stem like ‘%.js’ or cs-uri-stem like ‘%.pdf’ or cs-uri-stem like ‘%.png’ or cs-uri-stem like ‘%.cur’”
returns:
COUNT(ALL *) SUM(ALL sc-bytes)
———— —————–
23977 53910768
Statistics:
———–
Elements processed: 34195
Elements output: 1
Execution time: 0.22 seconds
This tells me that there were 23K requests for these file types, for a total of about 53Mb. The log in question only represents 1 hour from one of two servers hosting the site (I think you can process from multiple logs simultaneously – have to spend more time playing around). And it was really fast – < 1 second!
So kudos to whoever created this tool!