EvtClearLog function (winevt.h)
Removes all events from the specified channel and writes them to the target log file.
Syntax
BOOL EvtClearLog(
[in, optional] EVT_HANDLE Session,
[in] LPCWSTR ChannelPath,
[in, optional] LPCWSTR TargetFilePath,
[in] DWORD Flags
);
Parameters
[in, optional] Session
A remote session handle that the EvtOpenSession function returns. Set to NULL for local channels.
[in] ChannelPath
The name of the channel to clear.
[in, optional] TargetFilePath
The full path to the target log file that will receive the events. Set to NULL to clear the log file and not save the events.
[in] Flags
Reserved. Must be zero.
Return value
Return code/value | Description |
---|---|
|
The function succeeded. |
|
The function failed. Use the GetLastError function to get the error code. |
Remarks
To copy events from a channel or log file, call the EvtExportLog function.
You must specify the absolute path to the target log file; you cannot use relative paths and environment variables to specifying the target log file. The path can be a Universal Naming Convention (UNC) path. You should use .evtx as the file name extension.
This function affects only the channel—if the channel uses autoBackup or fileMax, this function will not affect those backup files.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2008 [desktop apps only] |
Target Platform | Windows |
Header | winevt.h |
Library | Wevtapi.lib |
DLL | Wevtapi.dll |