Clear All Event Logs in Event Viewer in Windows  

Page 1 of 11 123 ... LastLast
    Clear All Event Logs in Event Viewer in Windows

    Clear All Event Logs in Event Viewer in Windows

    How to Clear All Event Logs in Event Viewer in Windows
    Published by Category: Performance & Maintenance
    09 Sep 2020
    Designer Media Ltd

    How to Clear All Event Logs in Event Viewer in Windows


    Event Viewer is a tool that displays detailed information as event logs about significant events on your PC.

    Event logs are special files that record significant events on your PC, such as when a user signs in to the PC or when a app encounters an error. Whenever these types of events occur, Windows records the event in an event log that you can read by using Event Viewer.

    Advanced users might find the details in event logs helpful when troubleshooting problems with Windows and other apps. However, you may also wish to be able to quickly clear all event logs at once as needed.

    See also: Review events and errors using Event Viewer | Microsoft Docs

    This tutorial will show you how to quickly clear all event logs in Event Viewer as needed in Windows 10.

    You must be signed in as an administrator to be able clear all event logs.

    It is required for the Windows Event Log service to be enabled and running to clear logs in Event Viewer.

    This will not clear Analytic or Debug logs. If you have them enabled, the wevutl command returns an error, but all other logs will be cleared.

    Clearing all Event Viewer logs will also clear Reliability History.



    Contents

    • Option One: To Clear All Event Viewer Logs using a BAT file
    • Option Two: To Clear All Event Viewer Logs in Command Prompt
    • Option Three: To Clear All Event Viewer Logs in PowerShell
    • Option Four: To Clear Individual Event Viewer Logs in Event Viewer



    EXAMPLE: Event Viewer
    Clear All Event Logs in Event Viewer in Windows-event_viewer-2.png






    OPTION ONE

    To Clear All Event Viewer Logs using a BAT file


    1 Click/tap on the Download button below to download the .bat file below.

    Clear_Event_Viewer_Logs.bat

    Download

    Contents of .bat file for reference:

    Code:
    @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 All Event Logs have been cleared!
    goto theEnd
    
    :do_clear
    echo clearing %1
    wevtutil.exe cl %1
    goto :eof
    
    :noAdmin
    echo Current user permissions to execute this .BAT file are inadequate.
    echo This .BAT file must be run with administrative privileges.
    echo Exit now, right click on this .BAT file, and select "Run as administrator".  
    pause >nul
    
    :theEnd
    Exit

    2 Save the .bat file to your desktop.

    3 Unblock the .bat file.

    4 Right click or press and hold on the .bat file, and click/tap on Run as administrator.

    5 If prompted by UAC, click/tap on Yes.

    6 A command prompt will now open to clear the event logs. The command prompt will automatically close when finished.






    OPTION TWO

    To Clear All Event Viewer Logs in Command Prompt


    1 Open an elevated command prompt.

    2 Copy and paste the command below into the elevated command prompt, and press Enter.

    for /F "tokens=*" %1 in ('wevtutil.exe el') DO wevtutil.exe cl "%1"

    3 The event logs will now be cleared. You can close the command prompt when it's finished.






    OPTION THREE

    To Clear All Event Viewer Logs in PowerShell


    1 Open an elevated Windows PowerShell.

    2 Copy and paste the command below you want to use into the elevated PowerShell, and press Enter.

    Get-WinEvent -ListLog * | where {$_.RecordCount} | ForEach-Object -Process { [System.Diagnostics.Eventing.Reader.EventLogSession]::GlobalSession.ClearLog($_.LogName) }

    OR

    Get-EventLog -LogName * | ForEach { Clear-EventLog $_.Log }

    OR

    wevtutil el | Foreach-Object {wevtutil cl "$_"}

    3 The event logs will now be cleared. You can close PowerShell when it's finished.






    OPTION FOUR

    To Clear Individual Event Viewer Logs in Event Viewer


    1 Press the Win + R keys to open the Run dialog, type eventvwr.msc into Run, and click/tap on OK to open Event Viewer.

    2 Select a log (ex: Application) that you want to clear in the left pane of Event Viewer, and click/tap on Clear Log in the far right Actions pane. (see screenshot below)

    Clear All Event Logs in Event Viewer in Windows-clear_log_in_event_viewer-1.png

    OR

    3 Right click or press and hold on a log (ex: Application) that you want to clear in the left pane of Event Viewer, and click/tap on Clear Log. (see screenshot below)

    Clear All Event Logs in Event Viewer in Windows-clear_log_in_event_viewer-2.png

    4 Click/tap on Clear to confirm. (see screenshot below)

    Clear All Event Logs in Event Viewer in Windows-clear_log_in_event_viewer-3.png


    That's it,
    Shawn






  1. Posts : 591
    Windows 10 Pro 64bit; Windows 10 TP; KDE Neon
       #1

    Thank you very much, Brink, for this new tutorial! :)

    I will present the results after applying the commands on my system.

    First of all, it has indeed cleared my Event Viewer logs:

    Clear All Event Logs in Event Viewer in Windows-1.png

    I used the command in CMD, which by the way I have been always using (I mean, even on Windows 7). It works fine! There was only one issue in my Windows 10 Pro, though:

    Clear All Event Logs in Event Viewer in Windows-2.png

    I have no idea what this "AirSpaceChannel" is... I have seen this error in my system other times, as well. I am always using a wired LAN Internet connection. Can you please tell me what is this?


    Then I run the command from the PowerShell:
    Clear All Event Logs in Event Viewer in Windows-3.png

    I think the results were expected, right?
    I just don't understand what the last failure is, the one about the USBvideo/Analytic... Is that expected, too?

    So, thanks Brink! :)

    I am REALLY-REALLY looking forward for a tutorial on how to clear the Reliability History :)
      My Computers


  2. Posts : 27,157
    Win11 Pro, Win10 Pro N, Win10 Home, Windows 8.1 Pro, Ubuntu
       #2

    For Windows logs and Application and Services logs, there is also the manual way to clear specific logs(only these 2 sections, custom views can be Deleted and lost, but not Cleared for example:
    Clear All Event Logs in Event Viewer in Windows-screenshot-3-.png
    Clear All Event Logs in Event Viewer in Windows-screenshot-4-.png
      My Computers


  3. Posts : 68,543
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #3

    Hey Joanne,

    Yeah, I have no idea what "AirSpaceChannel" is for either.

    That would be normal in Powershell for any of the Analytic or Debug logs.
      My Computers


  4. Posts : 172
    10 Ent 64
       #4

    Why is it that as the admin I still have to run the bat as admin for it to work; just wondering since on win 7 I just run it as is and it clears all logs. Tried this and would not clear without running using the "run as administrator". Thanks
      My Computer


  5. Posts : 68,543
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #5

    Hello csmdew, and welcome to Ten Forums. :)

    It just needs to have elevated rights to be able to clear the event logs from the system.
      My Computers


  6. Posts : 3
    Windows 10 Professional
       #6

    Office 2016 includes the AirSpaceChannel


    It's Office 2016.

    Microsoft Office 2016 - AirSpaceChannel
    office 2016 airspacechannel - Google Search

    I know this is an older thread. Regardless, I wanted to post a note here just in case anyone else looks here as I did.

    Just FYI.
      My Computer


  7. Posts : 68,543
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #7

    Thank you windowsnt, and welcome to Ten Forums. :)
      My Computers


  8. Posts : 2,450
    Windows 10 Pro x64
       #8

    Shawn, thanks a lot for the script.
    One more excellent job (like the life saver I just did with the Restore_Windows_Photo_Viewer one!!!).
    This one seems to be working perfectly, except from one thing, which I have highlighted in the picture.
    Do you have any idea what it is and how it can be fixed?

    Clear All Event Logs in Event Viewer in Windows-cleareventviewerlog.jpg

    BR. Dimitri
      My Computer


  9. Posts : 68,543
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #9

    Hello Dimitri, :)

    You might see if it may be able to clear it while running it in Safe Mode.

    https://www.tenforums.com/tutorials/2...dows-10-a.html
      My Computers


 

Tutorial Categories

Clear All Event Logs in Event Viewer in Windows Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 03:11.
Find Us




Windows 10 Forums