In his monthly bulletin, Mark Minasi has covered Log Parser, a free tool available for download from Microsoft.
A First Query
Let's try out just about the simplest Log Parser command possible:
logparser "select * from *.log" -i:iisw3c
Picked apart, it is the command "logparser," followed by a SQL query statement -- don't run away, I'll show you all the SQL you'll need today! -- followed by the -i option, which explains to Log Parser what kind of file it is (an IIS log file, in this case). The SQL query is "Select * from *.log", which just means "get everything" -- the asterisk works in SQL the same as it does in DOS commands, meaning "everything" -- from all of the files with the extension "log" in the current directory.
(Aside: this is why learning Log Parser is difficult -- you're trying to learn two new things at the same time. Half of what you're trying to learn is Log Parser's syntax, which is ugly enough all by itself. But every Log Parser query includes a SQL query, and if you've never written SQL queries then you'll find that they're a quite wide field of syntax to master as well. I strongly recommend taking the time to browse through the logparser.chm Help file that installs in the same directory as Log Parser. And let me note at this point that I'm not a SQL query expert, so I may not be approaching these problems in the best way.)
Read more at source.