Solved

Query Event Log for errors by source

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
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 …
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

20 Experts available now in Live!

Get 1:1 Help Now