EvtClearLog function

Removes all events from the specified channel and writes them to the target log file.

Syntax


BOOL WINAPI EvtClearLog(
  _In_opt_  EVT_HANDLE Session,
  _In_      LPCWSTR ChannelPath,
  _In_opt_  LPCWSTR TargetFilePath,
  _In_      DWORD Flags
);

Parameters

Session [in, optional]

A remote session handle that the EvtOpenSession function returns. Set to NULL for local channels.

ChannelPath [in]

The name of the channel to clear.

TargetFilePath [in, optional]

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.

Flags [in]

Reserved. Must be zero.

Return value

Return code/valueDescription
TRUE

The function succeeded.

FALSE

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

Minimum supported client

Windows Vista [desktop apps only]

Minimum supported server

Windows Server 2008 [desktop apps only]

Header

WinEvt.h

Library

Wevtapi.lib

DLL

Wevtapi.dll

See also

EvtArchiveExportedLog
EvtExportLog

 

 

Community Additions

ADD
Show:
© 2014 Microsoft