How to: Clear Event Logs
Event logs are set to a maximum size that determines how many entries each log can contain. When an event log is full, it will either stop recording entries or begin overwriting the oldest entries with new entries, depending on the log's settings in the Windows Event Viewer. In either case, 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 entries.
By default, the Application, System, and Security logs are set to a default maximum size of 4992 K. Custom logs are set to a default maximum of 512 K.
You can also use the Windows Event Viewer to free up space on a log that has become full. You can set the log to overwrite existing events, you can write log entries to an external file, or you can increase the maximum size of the log. You cannot, however, remove only some of the entries in a log; when you clear a log, you remove all of its contents. For more information, seeor your Event Viewer documentation.
To clear an event log's contents from Server Explorer
Open Server Explorer, and then expand the node for the server on which the event log you want to clear resides. For more information, see.
If you do not see the server you want listed in the Servers node, right-click Servers, click Add Server, enter the name of your server, and then click OK.
Expand the Event Logs node.
You will see a list of the three main event logs — Application, Security, and System.
Right-click the log node you want to clear, and then click Clear Event Log.
Click Yes when prompted to confirm the deletion.
To clear an event log's contents programmatically
Create an instance of thecomponent and set the necessary properties to configure it. For more information, see and .
Use themethod to clear the contents of the appropriate event log.
Your code should look something like this: