NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Clearing Event Logs

Event logs are set to a maximum size of 512 KB. This size determines how many entries each log can contain. When an event log is full, its default behavior is to start overwriting the oldest entries with new entries. You can clear the log of its existing entries to free the log and allow it to start recording events again. You must have Administrator rights to the computer on which the log resides in order to clear event log entries.

Note   You can also use the Event Viewer to free up space on a log that has become full. You can set the log to overwrite existing events, or you can increase the maximum size of the log. For more information, see your Event Viewer documentation.

To clear an event log's contents programmatically

  1. Create an instance of the EventLog component and set the necessary properties to configure it. For details, see Creating EventLog Components  and Configuring EventLog Components.
  2. Use the Clear method to clear the contents of the appropriate event log. Your code should look something like this:
    [Visual Basic]
    EventLog1.Clear 
    [C#]
    EventLog1.Clear(); 

See Also

Accessing and Initializing Server Explorer  | Administering Event Logs