Cacheing remote event log

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Rob Oldfield (blah_at_blah.com)
Date: 03/03/05


Date: Thu, 3 Mar 2005 09:11:04 -0000

I have some code that loops through the entires in an event log which works
fine... but very, very slowly. I've found something on the web that claims
that using the copyto method of the entrycollection class to cache the
entries locally will speed things up... but I can't figure out how to get it
to work.

My code currently looks like this...

EventLog1.MachineName = Me.Machine.Text
EventLog1.Log = Me.LogName.Text

For Each ent In EventLog1.Entries
    'work on entry
Next

...and I've found this in the help files...

Dim myEventLogEntryArray(myEventLogEntryCollection.Count - 1) As
EventLogEntry
myEventLogEntryCollection.CopyTo(myEventLogEntryArray, 0)
Dim myEnumerator As IEnumerator = myEventLogEntryArray.GetEnumerator()
While myEnumerator.MoveNext()
Dim myEventLogEntry As EventLogEntry = CType(myEnumerator.Current,
EventLogEntry)
Console.WriteLine("The LocalTime the Event is generated is " + _
myEventLogEntry.TimeGenerated)
End While

.... but I can't figure out how to fit them together. Can anyone point me
in the right direction? Thanks.



Relevant Pages

  • Backup and Clear Event Logs
    ... I have a script that backs up and clears event logs and saves the file to a ... Dim dtmThisMonth 'Variable to hold current month ... dtmToday & vbTab & "Event Log Maintenance Successful." ... LogFile oFile, dtmToday & vbTab & "Error Backing up event log: ...
    (microsoft.public.windows.server.scripting)
  • Re: adding error checking to code
    ... The statement "On Error GoTo 0" restores normal error handling, ... ' Trap error if folder cannot be created. ... ' Setup for event log. ... Dim errorFolder ...
    (microsoft.public.scripting.vbscript)
  • WMI Reports a different time than the Event Viewer
    ... Application Event log for each machine running SQL Server using WMI and safe ... Here is the code I use to pull the data from the Application Event Log ... Dim objWMIService As Object ... Dim intLatestEvent As Variant ...
    (microsoft.public.windowsxp.wmi)
  • RE: Empty Event Logs from Windows 2003 Server,Win32_NTLogEvent,WMI
    ... I am not able to fetching the Event Log Info from My Machine ... Iam able to connect the Server Machine but iam unable to get any event log ... Dim oConn As New ConnectionOptions ... Dim Scope As ManagementScope ...
    (microsoft.public.dotnet.security)
  • Copying Events to a Database
    ... ' of the computers event log to an Access Database, ... Dim objConnection ... Dim dtmThisMonth ... Set objConnection = CreateObject ...
    (microsoft.public.scripting.vbscript)