Solved

Serch remote event log

Posted on 2008-10-02
5
332 Views
Last Modified: 2013-11-07
Hello,

I need to search the eventlog for a remote machine with specefied source.
 Then i need to read all logs to see if a logout exist after later than a logon.

IS this possible and is so, how?

Thanks,  
Peter
0
Comment
Question by:carnegieuk
  • 3
  • 2
5 Comments
 
LVL 11

Expert Comment

by:melmers
Comment Utility
You must import system.Diagnostics

Dim myEventLogReader as new Eventlog("Application","MachineName")
For each myEntry as EventLogEntry in myEventLogReader.Entries
    Console.WriteLine(myEntry.Message)
Next
0
 

Author Comment

by:carnegieuk
Comment Utility
OKey, so how can i read all entries and set online = "1" if we dont have any logoff after a logon?
0
 
LVL 11

Expert Comment

by:melmers
Comment Utility
With the sourcecode you can read all log entries.
i don't know your code so you must post it here or explain me more about your software.

But i think it's not a good idea to use the eventlog to identify if a user is logged in or logged off because of deleteing the eventlog from the user side or an admin script.

0
 

Author Comment

by:carnegieuk
Comment Utility
It's for monitoring a service, make sure it's logged on.

When the service log on to the system it writes a message in the eventlog containing logon when it logss out or if the connection dies it writes a message containing logout.

betwheen thes messages it can be a few hundred of entries.  

but i just realise that it's going to be to intens for the servers to run sutch a searc, it's a lot of eventlogs.

but maybe you can answear how to read eventlogs in realtime?
0
 
LVL 11

Accepted Solution

by:
melmers earned 500 total points
Comment Utility
When the software runs on the server itself and not on a remote one then you can use
the event EbntryWritten form the Eventlog Class.

This event is only fired when the software runs on the local server and is not connected to
a remote server.

You can also read the log and use the .EntryWritten property of an EventLogEntry Object
if the entrywritten timestamp is lower than yor last read then you can skip the entry
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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

772 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

11 Experts available now in Live!

Get 1:1 Help Now