A few weeks ago, Steve Trefethen published his Blog entry Publishing IIS log file analysis using Microsoft Log Parser, where he outlined how to use the free software MS Log Parser to run a basic analysis of the log files created by IIS. Today I set up my task scheduler to run two basic tasks once a day to generate Summaries on the most read blog entries as well as the top downloaded files from my conference page.
The whole setup process took less than 20 minutes to figure out how to format the query, to create the templates for displaying them within this blog layout and to setup the scheduler tasks. The last task was the "hardest", as you cannot use parameters when using the scheduler interface. After figuring out that problem, I simply created the batch files and pointed the task scheduler to them, which in turn run the queries.
If you like to use those tasks for your DasBlog site, simply install the MS Log Parser on your server and adjust the following calls.
The Top 50 Requested Pages
logparser.exe "SELECT TOP 50 to_lowercase(cs-uri-stem) as Url, COUNT(cs-uri-stem) AS Hits FROM D:\LogFiles\W3SVC2106058385\ex*.log WHERE (to_lowercase(cs-uri-stem) NOT LIKE '%%captchaimage%%') AND ((to_lowercase(cs-uri-stem) = '/blog') OR (to_lowercase(cs-uri-stem) = '/blog/default.aspx') OR (to_lowercase(cs-uri-stem) like '/blog/20%%.aspx')) GROUP BY Url ORDER BY Hits DESC" -o:tpl -tpl "D:\Sites\Blog\Content\Special\mosthits.format.tpl" > "D:\Sites\Blog\Content\Special\mosthits.format.html"
The Downloads-Counter
logparser.exe "SELECT TOP 50 to_lowercase(cs-uri-stem) as Url, COUNT(cs-uri-stem) AS Hits FROM D:\LogFiles\W3SVC2106058385\ex*.log WHERE (to_lowercase(cs-uri-stem) like '/downloads/%%') GROUP BY Url ORDER BY Hits DESC" -o:tpl -tpl "D:\Sites\Blog\Content\Special\downloads.format.tpl" > "D:\Sites\Blog\Content\Special\downloads.format.html"
The .tpl-files are formatted similar to the ones shown in Steve's blog.
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.
Theme design by Jelle Druyts