Event Logs are exactly what its name says. It keeps records of everything that takes place on the computer. When you or any other user had logged in on your computer, when an app was opened or when an error or app crash occurred, every event is recorded in the Event Logs.
Event Logs can be easily accessed using Event Viewer. So, if some error or any issue has happened on your computer, you can easily check its details from the Event Viewer. This helps a lot while troubleshooting any problems that have occurred on the computer.
Many people may want to clear an event or all events from the Event Logs. It can be done pretty easily. There are a number of ways to clear an event and all events from the Event Logs. If you are also looking for a way to do that, simply follow the methods mentioned below.
How to Clear Event Logs
Clearing the events from Event Logs is very easy. Perform the methods to do so.
Note: To access and delete Event Logs, you have to be logged in as administrator on the computer. If you are not logged in as the administrator, you will not be able to perform these methods. So, before following the methods, make sure you are logged in as administrator.
1. Clear Events Manually
In the first method, we will show you how to clear events from Event Logs manually. Here, we will delete the records of events right from the Event Viewer. Follow the steps to perform this method.
Step 1 – Search Event Viewer in Windows search box and then click on Event Viewer which appears in the search result.
Step 2. In the Event Viewer window, you will see the different set of events. If you want to delete an event, simply expand the event sets to find the particular event and then right-click on the event. Now select Clear log. When you are done, close the Event Viewer.
If you want to delete more events, simply perform the last step as many times as you want.
2. Clear Events from Command Prompt
In this method, we will show you how to clear events from Command Prompt. Here, you will be able to clear an event one by one. Follow the steps to perform this method.
Step 1. Open Command Prompt as Administrator. To do this, go to Cortana and type Command Prompt in the search area. Now, right-click on Command Prompt from search results and select Run as administrator.
Step 2. Now, in the Command Prompt window, type the following command and press Enter.
wevtutil el
Step 3. After the last step, a list of events will show up on the Command Prompt window. Here, look for the ones you want to delete.
Step 4. After the selecting an event you want to delete, type the following command and press Enter to delete the event.
wevtutil cl xyz
Here “xyz” is the name of the event you want to delete. Simply replace “xyz” with the event name you wish to clear from Event Logs.
That’s it. The event you wanted to delete, is no more mentioned in the Event Logs. To clear more events, simply repeat the last step with that event name in the command.
3. Clear All Events using Command Prompt
Clearing all the events using the Command Prompt is easy as well. In this method, we will use a .cmd file. Everything is explained below in the steps. Follow the steps to perform this method.
Step 1. First, we will have to create a .cmd file with some commands. To do this, go to your desktop and right-click on empty space. Here, go to New and then select Text document from the list of options that opens.
Step 2. Now, go back to Desktop and double-click on New text document to open the text document file you have just created.
Step 3. In the text document, copy and paste the following text.
@echo off
FOR /F “tokens=1,2*” %%V IN (‘bcdedit’) DO SET adminTest=%%V
IF (%adminTest%)==(Access) goto noAdmin
for /F “tokens=*” %%G in (‘wevtutil.exe el’) DO (call :do_clear “%%G”)
echo.
echo Event Logs have been cleared!
goto theEnd
:do_clear
echo clearing %1
wevtutil.exe cl %1
goto :eof
:noAdmin
echo You must run this script as an Administrator!
echo.
:theEnd
Step 4. Now, from the top left side of the window, open the File drop-down menu and select Save as….
Step 5. In the File name section, type ClearLog.cmd and click on Save. This will save the file with .cmd extension and with file name as ClearLog.
Step 6. Look for the file ClearLog fileon your desktop. You have to open it as administrator. To do that, right-click on it and select Run as administrator.
Now, you don’t have to anything. The Command Prompt window will open and it will clear all the events from Event Logs automatically.
4. Clear All Events using PowerShell
Windows PowerShell is another powerfull tool to execute commands. In this method, we will delete all the events using Windows PowerShell. Follow the steps to perform this method.
Step 1. Open Windows PowerShell as Administrator. To do this, go to Cortana and type powershell in the search area. Now, right-click on Windows PowerShell from search results and select Run as administrator..
Step 2. Now in the Windows PowerShell window, enter any one of the following commands and press Enter.
wevtutil el | Foreach-Object {wevtutil cl “$_”}
OR
Get-EventLog -LogName * | ForEach { Clear-EventLog $_.Log }
Step 3. The command will now clear all the events from Event Logs. Now simply type Exit and press Enter to close Windows PowerShell.
We hope we were able to help you clear events from Event Logs. If you have any questions, or if had any problem performing any of the methods, please mention them below in comments.