Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8919629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:04:53+00:00 2026-06-15T06:04:53+00:00

I have an application reading some data from the event log, this application performance

  • 0

I have an application reading some data from the event log, this application performance is too bad if the event log was too large, i.e. more than 30,000 entry.

I am searching for a faster way to get the info from it,

I have used for now two ways, using WMI the query was {Select message from Win32_NTLogEvent Where Logfile = ‘System’ and EventCode = ‘1’ }

I used System.Diagnostic.Eventlog.GetEventLogs(); which also takes too much time

What should I use to enhance the search speed?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:04:54+00:00Added an answer on June 15, 2026 at 6:04 am

    This simple piece of code takes 4.6 seconds on 100,000 events on AMD Athlon X3 (i5 is more faster).

    string queryString = "*";
    int eventsCount = 0;
    Stopwatch stopWatch = new Stopwatch();
    stopWatch.Start();
    EventLogQuery eventsQuery = new EventLogQuery("MyLog", PathType.LogName, queryString);
    EventLogReader logReader = new EventLogReader(eventsQuery);
    
    for (EventRecord eventInstance = logReader.ReadEvent();
                    null != eventInstance; eventInstance = logReader.ReadEvent())
    {
      if (eventInstance.Id == 100) //random event id                 
         ++eventsCount;
    
    }
    stopWatch.Stop();
    
    Console.WriteLine("Found events: {0}", eventsCount);
    Console.WriteLine("Time elapsed: {0}", stopWatch.Elapsed);
    

    For better performance you can use a properly created XPATH Query, by your own or via windows eventviewer (create Custom view than choose XML tab)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm sort of lost on this. I have an application that is reading from
I have C# WPF application which reads data from database then does some work.
I have an application where I am reading and writing small blocks of data
we have to application servers, both reading from the same JMS server, preferably from
I have an application that imports data read from text files from a directory
I have an application which is supposed to retrieve data from a Website every
I am implementing a PHP application that requires some data from Google Books API,
I have a VSTO addin and I'm reading data from an Excel worksheet. It
I have a web application that's caching some data and I am using a
I have an application build in C# for reading and saving SMS and MMS,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.