Generally you do not need to clear Windows event logs as they contain important information to troubleshoot any issues.
If you ever need to clear specific event logs, you can always do it via GUI and you can take the backup of the event logs before clearing them. Following are the steps to clear them using Windows Event Viewer:
- Start Event Viewer.
- In the console tree, navigate to the event log you want to clear.
- On the Action menu, click Clear Log.
- You can either clear the event log or save a copy of the event log and then clear it.
- To clear the event log without saving: Click Clear.
- To clear the event log after saving: Click Save and Clear, type a name for the saved file in File name on the Save As dialog box and click Save.
You can also clear Event logs using Windows command as follow:
wevtutil cl log_file_name [/bu: backup_file_name]
The following example clears all the events from the Application log after saving them to C:\administrator\backups\bak_application0101.evtx:
wevtutil.exe cl Application /bu:C:\administrator\backups\bak_application0101.evtx
Command line requires to specify log_file_name. You can obtain it using the following command:
The above command will list all log files name.
If you wish to clear all event logs without backup, you can use the following command:
for /F "tokens=*" %1 in ('wevtutil.exe el') DO wevtutil.exe cl "%1"
Please note that the above command will clear all event logs without backup. So be careful while executing the above command.