Solved

Query Event Log for errors by source

Posted on 2012-03-24
2
379 Views
Last Modified: 2012-03-26
Hi,

I am using C#4.0 and Windows Server 2008

I need to query the Application event log.

I  need to query like this:

Give me all events where Source = "x" and where Created Date >= "my date"

Also the event log may be on a different machine.  

Can anyone help please?

Thanks very much
0
Comment
Question by:MrKevorkian
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 37762699
I would use WMI and execute a query against Win32_NTLogEvent.

Win32_NTLogEvent class
http://msdn.microsoft.com/en-us/library/windows/desktop/aa394226(v=vs.85).aspx

Example query:

Select * from Win32_NTLogEvent Where Logfile  = 'Application' and SourceName like '%Backup%'"
0
 
LVL 1

Author Comment

by:MrKevorkian
ID: 37764778
thanks just having a look at this now.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…

728 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