Lisa Dean.Net

Doing stuff and things

Microsoft Log Parser: Coolest Thing Since Sliced Bread

I just stumbled upon a utility today that is going to save me a LOT of time — Microsoft Log Parser 2.2.

The past week has presented me with two different problems that I knew a SQL query would solve but my data was in text files and I wanted to keep it that way. I’m still a SQL newbie; I can write some queries to squeeze out the information I need but thats about it.

Let’s try MS Query

The first problem involved one text file with directory names and sizes. The second text file was a list of users with both username and userid as fields. I needed to find out which directories matched up with userid’s.

I found the MS Query* tool included with Office. Supposedly you can use it to treat both text files and Excel files as databases using SQL queries. I could never get it to work right for either file type. I shelved the problem for later.

That Didn’t Work, Now What?

On to the next puzzle. We have a field called employeeID added to the schema of Active Directory. I needed to find all accounts that have duplicate employeeID’s. I knew I could do this with a SQL query. I already had a CSV file containing a dump of several AD attributes for all users. I planned on importing the CSV file into a SQL table and working with it. In searching to figure out how to build the query, I found Log Parser.

Log Parser is a utility written by Microsoft originally to parse IIS logs. It does that and much, much more. It will parse just about any structured text file, the event log,  the file system, and the registry. It’s not a supported utility but this site has an active user community.

I was able to use this command to pull up a nice GUI table format:

logparser file:myquery.sql -i:csv -o:datagrid
Log Parser Datagrid View

Log Parser Datagrid View

This command exported the same information to a CSV file:

logparser file:myquery.sql -i:csv -o:CSV
-headers:ON > duplicate-employeeid.csv


My myquery.sql file looked like this:

SELECT employeeID,sAMAccountName,sn,givenName
FROM 'users.csv'
WHERE employeeID IN
  (SELECT employeeID
  FROM 'users.csv'
  GROUP BY employeeID
  HAVING (COUNT(employeeID) > 1))
ORDER BY employeeID


Then I discovered that Log Parser would query Active Directory! I knew how to use a simple SELECT statement in VBScript but it didn’t support all the SQL keywords I needed to use. This utility does that beautifully.

I changed my query file to this:

SELECT employeeID,sAMAccountName,sn,givenName
WHERE employeeID IN
  (SELECT employeeID
  GROUP BY employeeID
  HAVING (COUNT(employeeID) > 1))
ORDER BY employeeID


And ran this command and voila! A complex SQL query of Active Directory!

logparser file:myquery.sql -i:ADS -objectClass:User -o:CSV
-headers:ON > duplicate-employeeid.csv


The documentation that comes with Log Parser is very useful and comprehensive. I also found an article (part1, part2) describing how to use Log Parser to view all the different types of Exchange logs and pull information into charts and graphs. I’ll be checking that out for sure.

Download Log Parser here:
Apparently there’s a book, too: Microsoft Log Parser Toolkit: A complete toolkit for Microsoft’s undocumented log analysis tool
* MS Query located here for Office 2010: c:\Program Files\Microsoft Office\Office14\MSQRY32.EXE.

UPDATE 8/9/2011:

I found today that you can’t use JOIN in the queries for Log Parser. You CAN use the IN keyword to work around this. For a more complicated JOIN workaround, I suppose you could do one query, export it to a file and then do another query based on that.

Sample IN query:

FROM 'directory-size.txt'


Read CHM files on the iPad

Okay, so I’ve got Dropbox with a whole bunch of tech books in PDF and CHM format.

I’ve got GoodReader for reading PDFs and it connects to Dropbox like a champ. I’ve got CHMate Lite for reading CHM files but I have to use the awful Bonjour (I think it’s Bonjour) wireless interface to copy files from my computer to my iPad in CHMate Lite.

BUT, if I use GoodReader to download the CHM file open the file using CHMate Lite THROUGH GoodReader, I don’t have to mess with the wireless interface! AND it let’s you use CHMate on more than one CHM file. Excellent!

This link will get you and me an extra 250MB when you sign up at Dropbox:

Here are instructions for connecting GoodReader to Dropbox:

And here, Ali Parvaresh explains how to use GoodReader to open CHM files:

UPDATE: 8/9/2011

I’ve found that you can open CHM files directly through the Dropbox app in the same way you can open them on through Goodreader.

  • Download the file through Dropbox.
  • It will complain that it can’t read the file type.
  • Then tap the little box with an arrow in it and you get the same “Open With” dialog you get in Goodreader.

I did find that the Dropbox app doesn’t handle large files (>20MB) as well as Goodreader does.

UPDATE: 6/15/2012

Dropbox now gives you 500MB of free space when you sign up through my link.

I Miss My Smartphone

We recently got rid of our iPhone 4’s in favor of T-Mobile prepaid phones to save money.
iphone money
I determined that even after termination fees of $265 a piece and buying a batch of prepaid minutes, we’d save $1800 over the course of the 18 months left on the contract. I was able to sell our iPhones for $500 each on Amazon so we’ve recouped the termination fees.

We bought cheap used Motorola Razr phones off Ebay and loaded each up with 1000 minutes for $100 which won’t expire for a year. Going off our past phone usage trends, those minutes may very well last us a year. Also, I’m using Google Voice for free outgoing calls when I’m at a computer and need to make a long call.

Despite the money saving benefits and my efforts to convince myself that the convenience of a smartphone wasn’t worth $130 a month, I find myself missing my iPhone. We have iPads (Wifi only) to replace most of the functionality of the iPhone and I’m LOVING it, but it’s not the same pocketable goodness the iPhone is.

Things I miss about my iPhone:

  • The camera. You don’t realize how much you use it until you don’t have it.
  • Having a book in my pocket. I carry my iPad most everywhere, but it’s still not as convenient.
  • My music. I mostly listen to music while in the car on long trips. The iPad really kinda sucks for that. Too big and my FM transmitter doesn’t charge it.
  • The alarm. WHY couldn’t they have put a simple alarm app on the iPad? Seriously
  • Being able to play games like Words with Friends and Chess with Friends while out of Wifi range.
  • Having all my contacts available to dial on my phone.
  • Being able to scan simple documents and QR codes with the camera.
  • Being able to lookup anything anywhere.

When we embarked on this non-iPhone adventure, I was convinced I would never go back to a phone contract again. Prepaid all the way. If we lived in Europe and could buy a fully loaded SIM card at the corner gas station, I would still be thinking that. But the data services and phone selection suck on pre-paid in the US. Now, I know that when my husband gets a full time job after school, we’ll be getting the next iPhones that come out after that.

Is Your Pre-3GS iPhone Slowing Down?

Ever since the update to the 3.0 OS on my iPhone 3G, my iPhone has been slower than usual. As usual, I google to find a solution. One of the suggestions also doubles as a fix to a hot iPhone battery. Here are some things to try:

  • Do a “reboot” of your iPhone. Hold down the power button and the home button until you get a screen with an option to “slide to power off”. This will turn off your iPhone. Once it’s completely off, hit the power button again to turn it back on. You’ll need to do this periodically. — This gave me a noticeable increase in speed.
  • Clear your text message history. — I didn’t find a way to clear them other than one by one. I fortunately don’t do alot of SMS texting so this didn’t take long but probably did not have much of an impact for me speed-wise.
  • Clear the Safari cache. Settings > Safari > Clear Cache. — This made Safari snappier for me but I didn’t notice any other speed increases.

Results from this? Rebooting your iPhone occasionally is just a Good Thing.

Image via oskay

How to Apply for Unemployment in South Carolina

My husband just lost his job. Joy!! He needs to apply for unemployment and me, being the supportive spouse I am, found out what he needs to do to apply for unemployment.

His big question is, is of course:

How do I apply?

You can go to the unemployment office itself. However, the unemployment rate in South Carolina is 12% right now and it’s probably a very long line. To avoid that line you can applyonline.

The site lets you register for work (a requirement) and unemployment at the same time online. Just click on theOnline Claim Filing link on the front page. You can check your claim status and do your weekly benefit certification online as well or by phone.

I had two big questions which were answered on theSC Employment Security Commission’s FAQ:

How big will my unemployment check be?

If eligible, you can expect to draw approximately half of your regular pay, up to a maximum of $326.00 per week in South Carolina. The regular state program provides for a maximum of 26 weeks.

When will I get my check?

Most people can expect to receive a check in about 3 weeks.

Hopefully he won’t need the unemployment check for long but I’m glad it’s there.

SC Unemployment Claim webpage: