Windows OS Hub
  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu
  • Home
  • About

Windows OS Hub

  • Windows Server
    • Windows Server 2022
    • Windows Server 2019
    • Windows Server 2016
    • Windows Server 2012 R2
    • Windows Server 2008 R2
    • SCCM
  • Active Directory
    • Active Directory Domain Services (AD DS)
    • Group Policies
  • Windows Clients
    • Windows 11
    • Windows 10
    • Windows 8
    • Windows 7
    • Windows XP
    • MS Office
    • Outlook
  • Virtualization
    • VMWare
    • Hyper-V
    • KVM
  • PowerShell
  • Exchange
  • Cloud
    • Azure
    • Microsoft 365
    • Office 365
  • Linux
    • CentOS
    • RHEL
    • Ubuntu

 Windows OS Hub / Group Policies / Configuring Event Viewer Log Size on Windows

May 24, 2023 Group PoliciesPowerShellWindows 10Windows Server 2019

Configuring Event Viewer Log Size on Windows

Windows Event Viewer Logs store useful information that is needed when analyzing the status of services and applications in Windows, troubleshooting errors, and auditing security events. By default, the sizes of the Event Viewer logs in Windows are limited and when the file sizes are exceeded, new events begin to overwrite older ones. If too many events are sent to the Event Viewer, only the last few hours of events may be logged, which may not be sufficient for efficient monitoring and log analysis.

To prevent old events from being overwritten, and to ensure that you always have events for a long enough period of time, you can increase the maximum size of Event Viewer logs.

Contents:
  • How to Set Windows Event Log Size with PowerShell?
  • Adjusting the Event Log File Size from the Event Viewer Console
  • Increase the Size of Windows Event Log Files Using GPO

How to Set Windows Event Log Size with PowerShell?

Windows event log files are stored in the %SystemRoot%\System32\Winevt\Logs\ directory as .EVTX files. Note that there is a separate file for each log. So you can manage the maximum size of only the Windows log you need and leave the default settings for others.

WinEvt log files with EVTX extension

You can use PowerShell to view the current limits for all enabled Event Viewer Logs on Windows:

Get-Eventlog -List

PowerShell Get-Eventlog : list event logs

You can use the Get-WinEvent cmdlet to get the size of a specific event log file. For example, here’s how you can get the current and maximum size of the Security log file:

Get-WinEvent -ListLog Security| Select MaximumSizeInBytes, FileSize, IsLogFull, OldestRecordNumber, IsEnabled, LogMode

Get-WinEvent - view MaximumSizeInBytes and FileSize

You can use PowerShell to get the total size of the folder that contains the event log files:
"{0:N2} MB" -f ((gci c:\windows\System32\Winevt\Logs\| measure Length -s).sum / 1Mb)

To increase the maximum size of the log, you can use the wevtutul command line tool (the new size is set in KB):

wevtutil sl "Application" /ms:200000

Or you can use PowerShell to set a new maximum Application log file size:

Limit-Eventlog -Logname Application -MaximumSize 200MB -OverflowAction OverwriteOlder

Adjusting the Event Log File Size from the Event Viewer Console

The easiest way to increase the maximum log size is directly from the Event Viewer console.

  1. Open the Event Viewer MMC snap-in (eventvwr.msc);
  2. Select the required log (for example, Security) and open its properties;
  3. Set a new limit under Maximum log size (KB) and save the changes; How to increase maximum event log size from Event Viewer console?
  4. You can also select the action to be taken when the maximum log file size is reached:

    Overwrite events as needed (oldest events first) – this mode is used by default and implies that new events simply overwrite older events.
    Archive the log when full, do not overwrite events – the current event log is archived in the \System32\Winevt\Logs\ folder when full, and new events are written to a new EVTX file. You can access the archived event files through the Open Saved Log menu in the Event Viewer.
    Do not overwrite events (Clear log manually) – enable this option to protect your old events from being overwritten. Note that the log must be cleared manually to write new events.

Increase the Size of Windows Event Log Files Using GPO

You can use Group Policies to centrally manage the size of event log files on computers or servers in an Active Directory domain.

  1. Run the Group Policy Management snap-in (gpmc.msc), create a new GPO, and link it to the Organizational Units with the computers or servers you want to change the Event Viewer settings for (you may also link the GPO to the domain root);
  2. Navigate to the following GPO section Computer Configuration -> Policies -> Administrative Templates -> Windows Components -> Event Log Service. This directory contains nodes for managing the basic Windows logs:
    Application
    Security
    Setup
    System
  3.  To increase the maximum size of the log, select the Specify the maximum log file size (KB) option, enable it, and set the required sizeGPO: Specify the maximum log file size ;
  4. Update the Group Policy settings on the clients and check that the new maximum log file is now specified in the log properties and that you cannot change it. If you try to set a different size, an error will appear:
    Event Viewer The Maximum Log Size specified is not valid. It is too large or too small

    Event Viewer
    The Maximum Log Size specified is not valid. It is too large or too small. The Maximum Log Size will be set to the following: 61440 KB
Increasing the maximum Security log size on Active Directory domain controllers allows you to:

  • Store a user’s domain login history and view successful/failed logon attempts to a specific Windows host;
  • Find the source of user account lockout in AD;
  • Identify who created a user in AD, reset the user’s password, or change the membership of a specific security group.

Note that the GPO section described above doesn’t contain options for other Event Logs from Applications and Services Logs -> Microsoft. If you need to increase the size of another event log (other than the standard one), you can do it through the registry. Windows event log settings are stored in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\EventLog\<log_name> registry key. The maximum log file size is determined by the MaxSize parameter (REG_DWORD type). You can configure the registry value of the MaxSize parameter for a custom event log on domain computers by using Group Policy Preferences.

Learn how to use GPO to configure registry keys and settings.

In this example, we are going to increase the size of the Directory Service log on the domain controllers. This log’s settings are stored in the following registry key HKLM\SYSTEM\CurrentControlSet\Services\EventLog\Directory Service.

Change the Event Viewer max file size via registry

  1. Open GPO and go to Computer Configuration -> Preferences -> Windows Settings -> Registry;
  2. Select New -> Registry Item;
  3. Create a new registry parameter with the following settings:
    Hive: HKEY_LOCAL_MACHINE
    Key path: SYSTEM\CurrentControlSet\Services\EventLog\Directory Service
    Value name: MaxSize
    Value type: REG_DWORD
    Value data: 52428800 (the maximum file size is given in bytes. In our example it is 50 MB.)

    Increase Event Viewer Log Size via Group Policy Preferences

  • Check that the maximum log size is after updating the GPO on the DCs. Check event viewer new size in Windows
For example, if you want to store logs with a history of Remote Desktop connections to an RDS host for a long period of time, you need to increase the size of the Terminal-Services-RemoteConnectionManager log.

By increasing the size of Windows event logs, you can get more information over a longer period of time. For example, you can use event logs to get the Windows reboot history, find out who deleted a file from a shared network folder, or who changed NTFS permissions.

0 comment
1
Facebook Twitter Google + Pinterest
previous post
How to Detect Who Changed the File/Folder NTFS Permissions on Windows
next post
Microsoft Key Management Service (KMS) Volume Activation FAQs

Related Reading

Zabbix: How to Get Data from PowerShell Scripts

October 27, 2023

Tracking Printer Usage with Windows Event Viewer Logs

October 19, 2023

PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

October 15, 2023

How to Query and Change Teams User Presence...

October 8, 2023

How to Use Ansible to Manage Windows Machines

September 25, 2023

Leave a Comment Cancel Reply

Categories

  • Active Directory
  • Group Policies
  • Exchange Server
  • Microsoft 365
  • Azure
  • Windows 11
  • Windows 10
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • PowerShell
  • VMWare
  • Hyper-V
  • Linux
  • MS Office

Recent Posts

  • Zabbix: How to Get Data from PowerShell Scripts

    October 27, 2023
  • Tracking Printer Usage with Windows Event Viewer Logs

    October 19, 2023
  • PowerShell: Configure Certificate-Based Authentication for Exchange Online (Azure)

    October 15, 2023
  • Reset Root Password in VMware ESXi

    October 12, 2023
  • How to Query and Change Teams User Presence Status with PowerShell

    October 8, 2023
  • How to Increase Size of Disk Partition in Ubuntu

    October 5, 2023
  • How to Use Ansible to Manage Windows Machines

    September 25, 2023
  • Installing Language Pack in Windows 10/11 with PowerShell

    September 15, 2023
  • Configure Email Forwarding for Mailbox on Exchange Server/Microsoft 365

    September 14, 2023
  • How to View and Change BIOS (UEFI) Settings with PowerShell

    September 13, 2023

Follow us

  • Facebook
  • Twitter
  • Telegram
Popular Posts
  • Updating List of Trusted Root Certificates in Windows
  • Fix: Remote Desktop Licensing Mode is not Configured
  • Configure Google Chrome Settings with Group Policy
  • How to Delete Old User Profiles in Windows
  • How to Backup and Copy Local Group Policy Settings to Another Computer
  • Allow Non-admin Users RDP Access to Windows Server
  • How to Find the Source of Account Lockouts in Active Directory
Footer Logo

@2014 - 2023 - Windows OS Hub. All about operating systems for sysadmins


Back To Top