Solved

Event Log Monitor

Posted on 2009-04-13
8
1,828 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
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…
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.

706 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

19 Experts available now in Live!

Get 1:1 Help Now