Solved

Query Event Log for errors by source

Posted on 2012-03-24
2
377 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
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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

756 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