Solved

Event Log Monitor

Posted on 2009-04-13
8
1,855 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
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
Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Healthcare organizations in the United States must adhere to the guidance of both the HIPAA (Health Insurance Portability and Accountability Act) and HITECH (Health Information Technology for Economic and Clinical Health Act) for securing and protec…
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
The viewer will learn common shortcuts with easy ways to remember them. The viewer will then learn where to find all of the keyboard shortcuts, how to create/change them, and how to speed up their workflow.
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.

828 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