Edit

Event Logging Functions

Note

  • The Event Logging API was designed for applications that run on the Windows Server 2003, Windows XP, or Windows 2000 operating system. In Windows Vista, the event logging infrastructure was redesigned. Applications that are designed to run on the Windows Vista or later operating systems should now use Windows Event Log.

  • When you use the command with a remote computer, an error might occur due an incompatibility between Windows 11, version 24H2 or later and Windows 11, version 23H2 or earlier when viewing logs across versions. A similar compatibility issue might occur between Windows Server 2025 or later and Windows Server 2022 or earlier.

The following functions are used with event logging.

Function Description
BackupEventLog Saves the specified event log to a backup file.
ClearEventLog Clears the specified event log, and optionally saves the current copy of the log to a backup file.
CloseEventLog Closes a read handle to the specified event log.
DeregisterEventSource Closes a write handle to the specified event log.
GetEventLogInformation Retrieves information about the specified event log.
GetNumberOfEventLogRecords Retrieves the number of records in the specified event log.
GetOldestEventLogRecord Retrieves the absolute record number of the oldest record in the specified event log.
NotifyChangeEventLog Enables an application to receive notification when an event is written to the specified event log.
OpenBackupEventLog Opens a handle to a backup event log.
OpenEventLog Opens a handle to the specified event log.
ReadEventLog Reads a whole number of entries from the specified event log.
RegisterEventSource Retrieves a registered handle to the specified event log.
ReportEvent Writes an entry at the end of the specified event log.