Logparser: Calculate No. of hits for different Browser type from IIS Logs

Why you need to know this:

To figure out what kind of browser(IE, Firefox, Safari) requests are coming for your application.So that you can make sure your application is compatible with that browser type.

IIS 6 Log

IIS_Log

 

You can put the following into *.bat file and double click to execute.

Srcnt ==> It Returns the number of occurrences of a substring in a string , if not found then 0 is returned

@echo OFF

"C:\Program Files\Log Parser 2.2\logparser.exe" "select case strcnt(cs(user-agent),'Firefox') when 1 THEN 'Firefox' else case strcnt(cs(user-agent),'MSIE+6') when 1 THEN 'IE 6' else case strcnt(cs(user-agent),'MSIE+7') when 1 THEN 'IE 7' else case strcnt(cs(user-agent),'Safari') when 1 THEN 'Safari' else case strcnt(cs(user-agent),'Opera') when 1 THEN 'Opera' ELSE 'Unknown' End End End End End as Browser,count(cs(User-Agent)) as Hits into c:\pie.gif from C:\LogParserBlog\ex.log group by cs(User-Agent)" -chartType:BarStacked -o:chart -values:ON -view:ON

EXIT

 

Output:

IETypes

 

You can modify above query to include more browser type for example Opera

Else case strcnt(cs(user-agent),'Opera') when 1 THEN 'Opera' END

 

Hope this helps :)