Using the MS LogParser for rough statistics#

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.

Friday, October 05, 2007 12:51:55 PM (W. Europe Standard Time, UTC+01:00) #    Comments [2]  | 

 

Google AdSense


Comments are working now#

Due to a problem with the setup of the SMTP-Account comments to my blog where saved, however I was not notified and therefore did not publish them so far. I have scanned through all posts and published your comments now, as well as fixing the setup. In the future, comments should appear faster now, as I get notified about them from now on.

Sorry for any hurt feelings about not publishing them, they are online now.

Thursday, October 04, 2007 4:11:49 PM (W. Europe Standard Time, UTC+01:00) #    Comments [0]  | 

 

DasBlog Extension for Google AdSense#

Currently it is not much, but I already was asked how I added Google AdSense into my blog, which is based upon DasBlog. As far as I know, DasBlog offers no direct way to add an element only once between the feeds. Google AdSense limits you to three (I think) ad-areas per page, so adding the AdSense after every post is way too much and guarantees your removal from the AdSense program.

For now, I'll simply offer my macro for download and you can use it as you will. It is fairly easy to implement into your templates. To get it working, you have to edit the web.config file of your DasBlog. If you have not done so, you'll have to uncomment the settings for using macros and you have to instert a node for my macro in the newtelligence.DasBlog.Macros section.

<CONFIGSECTIONS>
        <SECTION type="newtelligence.DasBlog.Web.Core.MacroSectionHandler, newtelligence.DasBlog.Web.Core" name="newtelligence.DasBlog.Macros" requirePermission="false" />
        [...]
</CONFIGSECTIONS>

[...]

<NEWTELLIGENCE.DASBLOG.MACROS>
        <ADD type="MyGoogles.MyGoogleMacros,MyGoogles" macro="MyGoogleMacros" />
</NEWTELLIGENCE.DASBLOG.MACROS>

You need to download my macro (2 KB) and copy it into your DasBlog-bin folder. Now you are up and running. Open your template for your blog and insert the following line (customize the location of the file) for inserting any file content at the position.

<%IncludeContentOnce("C:\Webs\Site\Blog\Content\GoogleAdSense.txt", "ContentAdSense")|MyGoogleMacros%>

You can add multiple content this way, it will load the file and output its content straight into the expected position. The second parameter is a simple identifier which will allow you, when change, to add multiple different contents into your blog. I'll update this function soon to take more parameters allowing you to further control the contents position within the list of feeds.

The nice thing about creating macros for DasBlog is, that it is straight forward and easy. From first finding out abou macros to finally implementing a working solution it took me less than 15 minutes.

Thursday, October 04, 2007 7:54:24 AM (W. Europe Standard Time, UTC+01:00) #    Comments [0]  | 

 

All content © 2010, Daniel Wischnewski
On this page
Archives
Promoted Links
Blogroll OPML
My current Flickr Images
www.flickr.com
Dies ist ein Flickr Modul mit �ffentlichen Fotos und Videos von dwischnewski. Ihr eigenes Modul k�nnen Sie hier erstellen.
Recommendations
Sitemap
Special Pages
Disclaimer

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