|
EventLogGetNumberOfRecords
int
EventLogGetNumberOfRecords(string
servername, string logname)
Return
Value
Returns int variable containing
total number of records in the specified event log.
Parameters
servername
–
string that
specifies the Universal Naming Convention (UNC) name of the server
on which the event log is to be opened. If this parameter is
"localhost", the operation is performed on the local
computer.
logname
–
string that
specifies the name of the log. If a custom log cannot be found, the
event logging service opens the Application log.
Remarks
The oldest record in an
event log is not necessarily record number 1. To determine the
record number of the oldest record in an event log, use the
EventLogGetOldestRecord
function.
Package
Plug in module:
nd_eventlogplg.npl
Example
The following
example demonstrates the use of
EventLogGetNumberOfRecords.
# Example for EventLogGetNumberOfRecords
# Declare local variables string
sHostName = "localhost"
string
sLogName = "Application"
# Retrieve total number of records in event
log int
nNumberOfRecords = EventLogGetNumberOfRecords(sHostName,
sLogName)
if (nNumberOfRecords == -1)
Println("Could not connect
to the Event Log at ", sHostName)
stop
else
Println(sLogName, " Event log at ",
sHostName, " opened")
Println("Number of records
in Event log is", nNumberOfRecords)
endif
Output of the example script:
Application Event
log at localhost opened
Number of
records in Event log is 1236
|