Solved

Serch remote event log

Posted on 2008-10-02
5
333 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
ID: 22622752
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
ID: 22622863
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
ID: 22622906
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
ID: 22623174
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
ID: 22623546
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

910 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

22 Experts available now in Live!

Get 1:1 Help Now