LogParser and examples on the web

Posted on 2014-09-02
Last Modified: 2014-09-08

I'm looking at different pages on the web which discussing Log Parser where they share useful examples on how to query an IIS log file using LogParser.

Currently, I am using logparser 2.2 in Windows powershell yet logparser complains about some of its own example or syntax.

In this case I'm facing an issue which doesn't return an error or any warnning at:

Number of Hits per Client IP, including a Reverse DNS lookup (SLOW). I thought SLOW means it would take few minutes but nothing comes out of this command.

LogParser.exe -i:W3C "Query-From-The-Table-Below" -o:CSV

SELECT c-ip As Machine,  
        REVERSEDNS(c-ip) As Name,  
        COUNT(*) As Hits  
 FROM c:\inetpub\logs\LogFiles\W3SVC1\*  

Open in new window

so I run following command:

.\Logparser.exe  "SELECT c-ip As Machine,  
        REVERSEDNS(c-ip) As Name,  
        COUNT(*) As Hits  
 FROM c:\inetpub\logs\LogFiles\W3SVC1\*  
 GROUP BY Machine ORDER BY Hits DESC"  -i:W3C -o:CSV

Open in new window

It doesn't throw a message it just it stays on screen forever.

Am I missing something here?

Please advise.

Question by:akohan
    LVL 25

    Accepted Solution

    On first look, the Log Parser option "-i:W3C" should be "-i:IISW3C".  I ran the same command on a test log, 169K entries, and it took 3 min 53 sec:

    logparser -i:IISW3C  "SELECT c-ip As Machine, REVERSEDNS(c-ip) As Name, COUNT(*) As Hits  FROM 'C:\HTTPLogs\test\*.log'  GROUP BY Machine  ORDER BY Hits DESC "

    I suggest running the command against a small log file as a test to ensure its working for you.  Also, the test depends on your DNS cache for reverse name resolution.  The first run will be slow because your computer has to constantly do DNS queries, in addition to executing the log parser query against the log file(s).  If you start running this daily, the report may be a bit faster, on average.  I computer was analyzing about 720 log lines a second on the first run, but this depends on much bandwidth your Internet connection has.

    Here are a few links to good sites with examples:


    Also, you should check out Log Parser Lizard ( and Log Parser Studio ( it gives you a GUI for Log Parser and

    Author Comment

    Thank you Dan!
    So from what I understand it is OK to query the IIS log files directly rather than copying them in a specific folder/path and run a query on it. Right?

    Author Closing Comment

    Good tips.
    LVL 25

    Expert Comment

    by:Dan McFadden
    I tend to move the logs before I process them.  This does 2 things:

    1. prevents the logs from using too much space on the volumes where they are saved
    2. when querying them, the web server does not have to support the added pressure of serving up the files to the process that is accessing the logs

    So, to save space and to not consume too much server resources, I move my logs.

    If the web server does not have a lot of activity, then it is less of an issue.  If the web server (and sites) are very active, then I would never directly query the logs.


    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Debug Tools to analyse IIS process: This article focus on taking memory dumps from IIS to determine which code is taking more time and to analyse which calls hangs/causes more CPU usage. To take dumps,download the following. Install1: To st…
    Back in July, I blogged about how Microsoft's new server pricing model, combined with the end of the Small Business Server package, would result in significant cost increases for many small businesses (see SBS End of Life: Microsoft Punishes Small B…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now