Skip to content
Windows 🟡 Intermediate

How to Clear Windows 11 Event Viewer Logs Automatically

Richard
Written by
Richard
Updated 10 min read
How to clear Windows 11 event viewer logs automatically
How to clear Windows 11 event viewer logs automatically
Before you start
  • 3 ways to do it
  • Needs administrator rights

Event Viewer logs in Windows 11 record errors, warnings, and startup events on your computer. Left alone, they take up disk space over time.

Automated log clearing runs a task in the background on a schedule, so you do not have to delete the logs by hand. This tutorial covers the manual methods first, then the automatic ones. You can follow all of them on Windows 11 Home and Pro.

⚡ Quick Answer

Open Event Viewer, expand Windows Logs in the left pane, select a log such as Application or System, then click Clear Log… in the Actions pane. Choose Save and Clear to keep a backup.evtx file first, or Clear to delete the log immediately.

Advertisement

What Are Windows Event Logs?

Windows Event Logs are built-in system files that record background activity, application crashes, and hardware warnings. When a program fails or a driver stops working, Windows writes the details to a log file. Technicians use these files to diagnose problems.

The logs stay on your drive until they are cleared or overwritten. Windows already caps the main logs (Application, System, and Security) at a default size and overwrites the oldest events when a log is full. So size alone is rarely a crisis. Still, the logs add up, and many people want them cleaned on a schedule.

Advertisement

What Is Windows Event Viewer?

Event Viewer is the built-in program for opening and reading those log files. Think of it as a diary for the operating system. It sorts records into categories such as application errors, security warnings, and system events. Most everyday users never open it, but the logging service behind it runs all the time.

Event Viewer
Event Viewer

Why You Should Clear Windows Event Logs Regularly

Letting event logs pile up causes a few problems. These are the main reasons to clear them out regularly.

1Freeing Up Disk Space

Clearing the logs frees disk space. Individual log files start small, but on a busy machine, or one where the size limits have been raised, they can grow to several gigabytes over a few months. Deleting old records gives that space back for photos, games, and apps. It matters most on smaller solid-state drives.

2Improving Security

Event logs hold a detailed record of your software and system activity. If someone gains unauthorized access to your computer or local network, they can read the logs to learn about your user accounts and habits. Clearing the logs, or letting Windows manage them automatically, reduces what is left behind.

⚠️WarningThere is a trade-off. Logs are also your audit trail. If you clear them, you lose the evidence you would need to investigate a break-in or a crash. On a work PC or a shared machine, check with your IT team first. If you are unsure, save a backup copy before clearing.

3Fixing Event Viewer Issues

Corrupted log files can make Event Viewer freeze, run slowly, or fail to open in Windows 11. Clearing them gives Event Viewer a fresh start and usually gets it working normally again.

4Better System Monitoring

When you are chasing a current problem, thousands of old entries from months ago just get in the way. After a clear, whatever you see in Event Viewer is recent, so new errors are easy to spot.

Methods to Clear Windows Event Logs

There are several ways to clear your event logs. We start with the manual options and then move on to automation. If you only need to clean one log once, the first method is enough.

Method 1Clear Logs Using the Event Viewer Interface

Clearing a log from the Event Viewer window is the simplest manual method. You open the tool, pick one log, and use the Clear Log… action. It only touches the log you select, so the other logs stay as they are.

  1. Click the Start button, type Event Viewer, and press Enter. The Event Viewer window opens with a list of log groups in the left pane.
  2. In the left pane, click the arrow next to Windows Logs to expand it. You should see Application, Security, Setup, System, and Forwarded Events.
  3. Click the log you want to clear, such as Application or System. Its events appear in the middle pane.
  4. In the Actions pane on the right, click Clear Log…
  5. A confirmation window appears. Click Save and Clear if you want a backup copy first. Windows asks where to save it as an .evtx file. Click Clear to delete everything in that log straight away. Click Cancel to back out.
Advertisement

Once the log is cleared, the middle pane is empty or shows only a few new events. Clearing cannot be undone, so use Save and Clear if you might need the records later. Event Viewer can open the saved .evtx file again.

Method 2Clear All Event Logs Using Command Prompt

Command Prompt can clear every log at once, but it needs administrator rights. You open the command line as an administrator and run one command. This saves you from clicking through each category in Event Viewer.

  1. Click the Start button and type cmd. Command Prompt appears at the top of the search results.
  2. Right-click Command Prompt in the search results and select Run as administrator.
    Command Prompt
    Command Prompt
  3. If User Account Control asks whether you want to allow the app to make changes, click Yes. If you are on a standard account, you will be asked for an administrator password. The title bar of the window should now start with “Administrator”.
  4. Type the following command into the window and press Enter:
    💻Code
    FOR /F "tokens=*" %1 IN ('wevtutil el') DO wevtutil cl "%1"
  5. Windows goes through the event logs and clears them one by one. Text scrolls past quickly. When it stops and the prompt returns, the logs are cleared. A few logs may show an access error. That is normal for logs that are protected or in use.
⚠️WarningThis clears every log, including Security. There is no confirmation prompt and no backup, so be sure before you press Enter.

Method 3Clear All Event Logs Using a Batch File

A batch file saves you from typing the command each time. You paste a short script into a text document, save it with the .bat extension, and run it with one right-click. This is also the file the scheduled task uses later.

  1. Right-click an empty space on your desktop, hover over New, and select Text Document.
  2. Open the new text file with Notepad.
  3. Copy and paste the following lines into the document:
    💻Code
    @echo off
    FOR /F "tokens=*" %%G IN ('wevtutil el') DO (wevtutil cl "%%G")
    echo All Event Logs have been cleared!
    timeout /t 5
  4. Click File in the top left corner, then click Save As.
  5. Change the Save as type dropdown to All Files (*.*). If you skip this, Notepad adds .txt to the name and the script will not run.
  6. Name your file something simple like ClearLogs.bat and save it to your desktop. The file should show a gear-style batch file icon, not a Notepad icon.
  7. To run your new script, right-click the ClearLogs.bat file on your desktop and select Run as administrator. If you run it with a plain double-click, it will not have the rights it needs. Click Yes at the User Account Control prompt.

A black window flashes up while the script runs, then closes. Open Event Viewer afterward to confirm the logs are empty.

How to Clear 🪟 Windows 11 Event Viewer Logs Automatically

To clear the logs automatically, use Task Scheduler. It is built into Windows 11 Home and Pro. You pair it with the batch file from the last section, and Windows runs the cleanup on the schedule you choose.

Advertisement
  1. Click the Start button, type Task Scheduler, and press Enter.
  2. In the right-hand Actions pane, click Create Task… (not Create Basic Task). The Create Task window opens with several tabs. You need to be signed in as an administrator for this.
  3. On the General tab, type a name for your task, such as Automatic Event Log Cleaner.
  4. Check the box that says Run with highest privileges. This step is critical because clearing logs requires administrator rights. If the box is greyed out, you are not signed in as an administrator.
  5. Click the Triggers tab near the top, then click the New… button at the bottom. The New Trigger window opens.
  6. In the Begin the task dropdown, choose On a schedule. Then pick how often you want the cleaning to happen, such as Weekly or Monthly, and set a start day and time when the PC is normally on. Click OK.
  7. Click the Actions tab, then click the New… button.
  8. Leave Action set to Start a program. Click the Browse button and find your ClearLogs.bat file that you created earlier. Click Open, then click OK. The file path now appears in the Program/script box.
  9. Click OK at the bottom of the main Create Task window to save the task. You may be asked for your password. The task now appears in the Task Scheduler Library.

To test it, select the task in the Task Scheduler Library and click Run in the right-hand pane. Then check Event Viewer. If it does not work, check the Last Run Result column.

Do not move or rename the batch file afterward, or the task will fail. Keep it somewhere it will not get deleted when you tidy the desktop. On a laptop, the task may skip runs on battery power. You can change that on the Conditions tab. To stop the automation later, right-click the task and choose Disable or Delete.

Your computer will now run the cleaning script on the schedule you chose, with no further action from you.

Advanced Tip: Automatically Overwriting Old Logs Without Scripts

Overwriting old events is a built-in option that needs no scripts or scheduled tasks. Each log has a maximum size. When it fills up, Windows can replace the oldest events with new ones. This is already the default for the main logs. Checking it confirms that nobody has changed it, and lets you pick a size that suits you.

  1. Open Event Viewer by searching for it in the Start menu.
  2. In the left pane, expand Windows Logs and click the log you want to manage, such as Application.
  3. Right-click the log name and select Properties. The Log Properties window opens on the General tab.
  4. Find the Maximum log size (KB) box. Type the size limit you want, in kilobytes. For example, 102400 is about 100 MB.
  5. Under “When maximum event log size is reached”, select Overwrite events as needed (oldest events first).
  6. Click Apply and then click OK.

Repeat these steps for each log you want to limit. The change takes effect immediately and does not need a restart. Windows now keeps each log inside its size limit by discarding the oldest events, so you do not need to watch it. The other options in that window, Archive the log when full, do not overwrite events and Do not overwrite events (Clear logs manually), can make logs grow without limit. Avoid them unless you have a reason.

Summary

Windows 11 Event Viewer logs record important system errors and background activity. Over time they can grow and take up disk space. You can clear them manually in Event Viewer or with Command Prompt. You can also automate the cleanup with a batch file and Task Scheduler, or let each log overwrite its oldest events once it hits a size limit.

For most people, a sensible size limit with overwriting enabled is enough. Use the scheduled clear if you want the logs emptied regularly. Either way, remember that clearing logs removes troubleshooting history, so save a backup first if you may need it.

Have a question about this guide?

Answered by AI from this guide. Good questions may be added to this page — please don't include personal details.

Tags: #Windows 11

Did this guide fix your problem?

Richard

About the Author

Richard

Tech Writer, IT Professional

Richard is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.

Advertisement

No comments yet — be the first to share your thoughts!

Leave a Comment

Your email address will not be published. Required fields are marked *