In this comprehensive tutorial, you will learn how to optimize the size of your event logs and prevent issues related to log overflow. This step-by-step guide will provide you with all the necessary information to successfully set the right file size for your event logs.

• Windows 2012 R2
• Windows 2016
• Windows 2019
• Windows 2022
• Windows 10
• Windows 11

Equipment list

Here you can find the list of equipment used to create this tutorial.

This link will also show the software list used to create this tutorial.

Related tutorial - PowerShell

On this page, we offer quick access to a list of tutorials related to PowerShell.

Tutorial Powershell - Configure the Event Log File Size

Start an elevated Powershell command line.

Windows 10 - powershell elevated

List the configuration of Windows Event Log Files.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

Configure the size of a Windows Event Log File.

Copy to Clipboard

The value supplied has to be in the range of 64 KB to 4GB with an increment of 64 KB.

Configure the overflow action of an Event Log File.

Copy to Clipboard

In our example, we configured the retention of 32 days for the System log file.

Other commands related to Windows Event Logs.

Copy to Clipboard

Here is the command output.

Copy to Clipboard

With the knowledge gained from this tutorial, you now have the skills to configure the Windows Event Log file size using PowerShell.