?
Solved

Query Event Log for errors by source

Posted on 2012-03-24
2
Medium Priority
?
380 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 2000 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

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

777 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