views:

183

answers:

3

I have to monitor a large log file during the day with C#. The size goes up to 200-300 MB for a day.
What is the most efficient way to analyze it?
The file is locked by the producing program. Preferably I would either have a read which realises that lines have been added or would read backwards.

+2  A: 

Check out the following:

how-to-read-a-text-file-reversely-with-iterator-in-c

DarkBobG
A: 

Change log rotation to a smaller value and then process the rotated logs - or - Process the whole log file the first time and remember the fileoffset / line for the next checking interval.

DCA
+2  A: 

A combination of MemoryMappedFile and FileSystemWatcher should do the trick.

Oliver