Best method for reading event logs.

Posted on 2006-05-12
Last Modified: 2010-04-16

I'm writing an app to collate the outcome of Backup Exec backups. This basically involves using the System.Diagnostics.EventLog class to read through all the entries on a machine, that have a source of "Backup Exec", and then pulling those entries out into an array.

The problem I have, is that some of the machines have in excess of 50,000 events in their application log (that raises housekeeping questions - but we'll ignore those for now), which means my app takes ages to trawl through them all.

What makes this worse is that the events i'm interested in are generally the newest, and the iteration through the event log starts with the oldest, so I nomally have 49000+ iterations that don't need to occur.

Is there anyway I can reverse the direction of the iteration through eventlog.entries?  This means I would be able to break out of the loop as soon as I had found the event i'm after.


Question by:lambch0p
    LVL 12

    Accepted Solution


     Property Entries of an EventLog is an indexed collection, so you can access its entries by index:
    EventLog lg = new EventLog("Application");

    Author Comment

    That's what I was after.



    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Bit flags and bit flag manipulation is perhaps one of the most underrated strategies in programming, likely because most programmers developing in high-level languages rely too much on the high-level features, and forget about the low-level ones. Th…
    Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now