Using Log Parser To Query IIS Log Files

Using Log Parser To Query IIS Log Files

Using Log Parser To Query IIS Log Files

I had forgotten how much I loved using Log Parser as I haven’t had the need to in ages. However, using it again made me realize the flexibility and usefulness of this tool.

In case you hadn’t used this tool before, it was created by Microsoft as a tool for sysadmin to be able to use SQL-like syntax to query log files in a variety of format. In this case, I needed to find out if a particular page was ever being called on a live website. In this particular case we aren’t running Google Analytics (where I would normally look for this answer) because this is a redirector site that never really shows a page.

Not relishing having to search through hundreds of daily log files and searching for the filename in question, I instead turned to Log Parser and asked it the following:

[well type=””]
LogParser -i:IISW3C “SELECT cs-uri-stem as [Request URI] from *.log WHERE cs-uri-stem LIKE ‘/ClickTrack.aspx%'”
[/well]

The key to searching across multiple files was to pass the -i parameter indicating that the files were in standard IISW3C format. That allowed me to use *.log as the input for the query whereas normally I’d only be able to query one file at a time.

Don’t like using the command line interface for this tool or want a way to make it easy to store your favorite queries? Then you’ll probably want to look into the Office Log Parser Studio tool that gives you a nice GUI for launching and managing your scripts.

Happy SysAdmin Day tomorrow! I hope you find this tool as useful as I do…

Stalk Me...

Michael Gibbs

I'm a technologist at heart, assisting companies best utilize the Internet to market themselves and sell their products and services online. This includes organizations as large as Google and as small as one or two individuals.
At Over The Top and Exhibit A Communications, I've programmed solutions for Google as well as at least one other company that was later acquired by Google.

I've been CTO of an Internet SaaS company and spent my time pretty evenly between guiding the future technical strategy of the company, architecting software solutions for my dev teams, designing and running a data center to service our clients world-wide as well as being a technical evangalist/sales engineer to our media clients large and small.

I've also been Chief Photographer of the Daily Sun/Post newspaper back when it was a 5-day a week daily newspaper.

I also spent a great many years as a beach lifeguardfor the City of San Clemente as well as Jr. Lifeguard instructor and then as it's program coordinator.
Bragging rights
Private Pilot with Instrument rating and proud husband of soon to be 25 years (and counting).
Stalk Me...

Latest posts by Michael Gibbs (see all)

Leave a Reply