Solved

Event Log Monitor

Posted on 2009-04-13
8
1,861 Views
Last Modified: 2013-12-17
VERY NEW to C# (coding in general)

I want to write an app (console or preferably a service) that will watch the event log for specific words in a Description, and react based upon that error.   For instance:

An event log is written to the Application Log with the word "Fiddler" in the description.  The app will then look back 5 minutes for any other events that may have been recorded (meeting the same criteria) plus look for an event that indicates that a specific service has been recycled....if true, do nothing.  If there are events and the service has not been recycled then recycle the service in question.

The last part just prevents a loop from occurring.  the events will happed when the service is recycled...that is the reasoning behind looking back 5 minutes.
0
Comment
Question by:crokeefe28
[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
8 Comments
 
LVL 8

Accepted Solution

by:
ppittle earned 500 total points
ID: 24132192
crokeefe28,

Take a look at this code example:

http://asp.dotnetheaven.com/howto/doc/LogMonitor.aspx

PJ
0
 
LVL 7

Author Comment

by:crokeefe28
ID: 24132621
The example is VB.NET....I need C#.  Plus that only writes one new event to the console.
0
 
LVL 50

Expert Comment

by:Steve Bink
ID: 24144235
>>> The example is VB.NET....I need C#.  Plus that only writes one new event to the console.

I disagree.  The sample looks like C to me.  It's using C syntax ("string log;" instead of "Dim log as String"), and even has the label C# everywhere on the page.  In fact, the only reference I see to VB.NET at all is in the drop-down box at the top of the page to go to another section.

As far as writing one event to console, that's the example.  Look at it, understand it, then expand it according to your own needs.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 96

Expert Comment

by:Bob Learned
ID: 24148691
That web page lets you switch between languages like VB.NET, C#, and C++.
0
 
LVL 7

Author Comment

by:crokeefe28
ID: 24153945
I did not see the area on the left to switch between VB and C#.  I will read a little further, but I was hoping to get a better understanding of the requirements to make it happen (being so new to this).
0
 
LVL 50

Expert Comment

by:Steve Bink
ID: 24154058
>>> That web page lets you switch between languages like VB.NET, C#, and C++.

LOL!  I get it now...  :)
0

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This guide will walk you through the essential considerations and tech stack for building scalable websites. Know how to grow your business the smart way!
This video demonstrates how to use each tool, their shortcuts, where and when to use them, and how to use the keyboard to improve workflow.
The viewer will learn how to successfully download and install the SARDU utility on Windows 8, without downloading adware.

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