How to Clear the Event Logs: 5 Ways to do it
You can manually clear the selected logs from the software
4 min. read
Updated on
Read our disclosure page to find out how can you help Windows Report sustain the editorial team. Read more
Key notes
- You can clear event logs right from the application itself with just a few clicks.
- More advanced users can try to clear event logs using the command line.
Event Log is the best way to keep track of issues on your PC, but many are wondering if it’s possible to clear event logs.
Clearing the log is one of the best Event Log practices, and in today’s guide, we will show you how to perform it properly.
Is it OK to clear event logs?
- Yes, it’s perfectly fine to remove event logs, but you shouldn’t do it too frequently.
- By doing so, you’ll minimize the number of logs, and you’ll be able to find current issues easier.
- Do keep in mind that you don’t remove them too often because you might need them to fix a certain problem.
- Clearing the logs may help when you get the Failed to transfer logged messages to event log error.
How can I clear event logs?
1. Use the manual method
- Open the Control Panel.
- Click on Administrative Tools in the System and Security window. You can also type event in the search menu and select View event logs.
- Now you will need to be signed in as administrator and double click (left click) on Event Viewer.
- After opening Event Viewer, you will have a list of events you can access.
- Right-click on the event you want to clear and then left on the Clear log.
- After you are finished with clearing the event logs close the Event log window, and you can go on with your work.
2. Use Command Prompt to clear a single event
- Open the start menu and type cmd.
- After it finds the cmd icon you will need to right click on it and select Run as administrator.
- You will need to type the following command:
wevtutil el
- Now that you have the list of event logs in front of you, write down the one you want to clear.
- For clearing a specific event write down the command below followed by the name of the log, like this for example: wevtutil cl Error
3. Use the Command Prompt
- Open Notepad 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 - Save that text as .bat or .cmd file (Name the file with quotes to automatically save it as .cmd file, like ClearLog.cmd)
- Run .cmd file you just saved as the administrator
- Just let the command finish
That’s all, all your event logs are now cleared. This is probably the simplest way to clear all event logs in Windows 10, but if you want to try other ways, see how to do that below.
4. Use the PowerShell
- Go to Search, type powershell, right-click on PowerShell and choose Run as administrator.
- Enter the following line into PowerShell and press Enter:
wevtutil el | Foreach-Object {wevtutil cl "$_"}
- Now just type Exit to close PowerShell window.
If you decide to use PowerShell to clear event logs, you’ll clear multiple logs in a matter of seconds.
5. Use the sing VBScript/WMI
- Open Notepad and enter the following text:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate, (Backup, Security)}!" _
& strComputer & "rootcimv2")
Set colLogFiles = objWMIService.ExecQuery _
("Select * from Win32_NTEventLogFile")
For each objLogfile in colLogFiles
objLogFile.ClearEventLog()
Next - Save it as VBScript (.VBS), take a look at method 1 on how to save file as .vbs directly, name it, for example ClearEvent.vbs
- Move ClearEvent.vbs you just created to
C:\Windows\System32
- Now open Command Prompt as administrator and run the following command:
CScript ClearEvent.vbs
As you can see, these are just a couple of methods to remove logs on your PC.
If you’re looking for more powerful software, check our guide on the best event viewer software.
What method do you use to clear the event logs? Share it with us in the comments below.
User forum
2 messages