How to limit logs in event viewer?

hendri yu 66 Reputation points
2021-01-14T03:24:23.933+00:00

Dear Expert,

Good Day

May i know how to limit the windows log in event viewer to something like 1 or 2 weeks? Meaning that after 1-2 weeks it will overwrite the old log in order to reduce the log size that keep growing and save some space.

Thanks
H

Windows Server 2012
Windows Server 2012
A Microsoft server operating system that supports enterprise-level management, data storage, applications, and communications.
1,538 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Dave Patrick 426.2K Reputation points MVP
    2021-01-14T03:47:35.577+00:00

    There isn't an option to limit by time stamp. You can limit the log by file size.

    56402-image.png

    --please don't forget to Accept as answer if the reply is helpful--


  2. Mico Mi 1,921 Reputation points
    2021-01-14T05:57:57.347+00:00

    Hi,
    You can take a look at these docs about Limit-EventLog cmd:
    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/limit-eventlog?view=powershell-5.1
    https://4sysops.com/archives/managing-event-logs-with-powershell-part-1
    The Limit-EventLog cmdlet sets the maximum size of a classic event log, how long each event must be retained, and what happens when the log reaches its maximum size. You can use it to limit the event logs on local or remote computers.
    OverflowAction specifies what happens when the event log reaches its maximum size. The acceptable values for this parameter are:

    • DoNotOverwrite: Existing entries are retained and new entries are discarded.
    • OverwriteAsNeeded: Each new entry overwrites the oldest entry.
    • OverwriteOlder: New events overwrite events older than the value specified by the MinimumRetentionDays property. If there are no events older than specified by the MinimumRetentionDays property value, new events are discarded.

    If you want to save some space, you can also use the following methods to adjust event log size:
    https://helpcenter.netwrix.com/NA/Configure_IT_Infrastructure/Windows_Server/WS_Event_Log_Settings.html

    Thanks for your time!
    Best Regards,
    Mico Mi

    -----------------------------

    If the Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments