Eventlog changed listener

G

Guy Noir

Hello. I've been scouring the newsgroup for the answer to my question
but I can't seem to find it.

What I CAN do: Read the event logs, parse them...act on them.

What I WANT to do: Have a service running so that when an event is
written to the windows eventlog, this triggers my program to look at
that specific event and decide if I should act on it or not....

In other words, I need some kind of "event trigger" that is raised when
the event log changes or gets a new event.

Ideas? Is this do-able?

Thanks in advance!!
 
G

Guy Noir

Disregard. I always find the answer after I google for an hour, finally
give up, then the answer pops right up!
From:
http://msdn.microsoft.com/library/d...vbcon/html/vbtskhandlingeventwrittenevent.asp

// C#
private void eventLog1_EntryWritten(object sender,
System.Diagnostics.EntryWrittenEventArgs e)
{
if (e.Entry.Source == "MyApplication")
Console.WriteLine("Entry written by my application. Message: "
+ e.Entry.Message);
else
Console.WriteLine("Entry was written by another application.");
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top