Most recent post

Sunday, March 16, 2008

Freeware - Logparser.VSSJournal

Now that I understand the Log Parser COM input format plugin I have migrated the VSSMonitor code into a Log Parser input format plugin.

Features :-
  • Read VSS 6.0 Journal files via Log Parser queries
  • Supports all fields and converts dates
  • Supports iCheckPoint feature -custom implementation, but basically the same as the implementation that Log Parser natively supports
  • Logs any errors to console and to EventLog.Application
  • VB.NET source code included
  • Supports only a single VSS Journal file in a single call. e.g. * , ; are not supported.
Below are some of the challenges :-

1. Implementing iCheckPoint - Because I used StreamReader there was a whole lot of hassle (i.e. research) in trying to record the position that I had streamed in the file. The biggest problem is StreamReader position can be different from the stated StreamReader.BaseStream.Position, there are lots of articles out there about this, however in my specific implementation I believe I'm safe. I first mark the StreamReader.BaseStream.Position from the last recorded file position before I even do a read. Then I ReadLine the file contents and when I get to the end I record the StreamReader.BaseStream.Position. The StreamReader reads ahead and stores in a buffer, however at the end of the file there is nothing else to read so the StreamReader.BaseStream.Position is at the end.

2. Storing the iCheckPoint values - I wanted to create a flexible solution to store the iCheckPoint values. Now I could simply store only the offset of a single file, however I wanted to be as flexible as the Log Parser team have made theirs so I wanted to allow for multiple offsets based on the specified FROM fields. I decided to make a ArrayList with a Class per each file parsed using serialization. The standard Microsoft System.Xml.Serialization.XmlSerializer class doesn't support complex structures, so I couldn't use this. I found on the CodeProject site a piece of code that supports serializing and de-serializing complex class structures which I had added to the code.

Download. VB.NET source is included in download.

*************************************************
To install:
1. Copy the LogParser.VSSJournal folder to a location on your harddrive
2. Run the command .\LogParser.VSSJournal\InstalldotNETasCOM.bat (need GACUTIL.EXE - part of the .NET FW 2.0 SDK - why?)
3. Run your Log Parser query.

e.g.

LogParser.exe -i:COM "select * From 'journal.txt'" -iProgId:Gluegood.LogParser.VSSJournal -iCOMParams:iCheckPoint=VSSCheckpoint.chk

*************************************************

** Legal **
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

0 Comments:

Post a Comment

<< Home