Specify the maximum log file size (KB)
Spécifier la taille de fichier journal maximale (Ko)
Explanation
This policy setting specifies the maximum size of the log file in kilobytes.
If you enable this policy setting, you can configure the maximum log file size to be between 20 megabytes (20480 kilobytes) and 2 terabytes (2147483647 kilobytes), in kilobyte increments.
If you disable or do not configure this policy setting, the maximum size of the log file will be set to the locally configured value. This value can be changed by the local administrator using the Log Properties dialog, and it defaults to 40 megabytes.
Ce paramètre de stratégie spécifie la taille maximale du fichier d'historique en kilo-octets.
Si vous activez ce paramètre de stratégie, vous pouvez configurer la taille maximale du fichier d'historique, comprise entre 20 mégaoctets (20 480 kilo-octets) et 2 téraoctets (2 147 483 647 kilo-octets), par incréments (en kilo-octets).
Si vous désactivez ce paramètre de stratégie ou ne le configurez pas, la taille maximale du fichier d'historique correspond à la valeur configurée localement. Cette valeur peut être modifiée par l’administrateur local dans la boîte de dialogue des propriétés du journal et la valeur par défaut est 40 mégaoctets.
Use cases
Sets the maximum size of the Security log, from 20 MB to 2 TB (local default: 40 MB). A log that is too small overwrites itself quickly on a domain controller or a heavily used server, and the traces of an intrusion are lost before anyone analyses them.
Size alone does not protect: an attacker who compromises a server can clear its local log, which is why forwarding events to a central collector matters. Microsoft also notes that if “Audit: Shut down system immediately if unable to log security audits” is enabled and the log fills up, the machine shuts down: size the log accordingly or turn that option off.
Microsoft source: Event Log Policy Settings: Security Policy
Registry
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\EventLog\Security- Value name
- not defined in the ADMX
Enable / disable values: not defined in the ADMX (see the options below).
PowerShell
PowerShell commands that write to the registry what the policy would write. Values in angle brackets (<…>) must be replaced.
Writing directly to the registry bypasses Group Policy: if a GPO manages this value, it will be rewritten at the next gpupdate; otherwise the value stays in place (the "tattooing" effect). Prefer a GPO or, locally, LGPO.exe. Run PowerShell as administrator for HKLM. Some policies need a restart or gpupdate /force.
Enable
# Enable: EventLog/Channel_LogMaxSize_2
$k = 'HKLM:\Software\Policies\Microsoft\Windows\EventLog\Security'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
# Maximum Log Size (KB)
Set-ItemProperty -Path $k -Name 'MaxSize' -Value 40960 -Type DWord # between 20480 and 2147483647Disable
# Disable: EventLog/Channel_LogMaxSize_2
# No value is written in the "Disabled" state (nothing defined in the ADMX)Revert to "Not configured"
# Revert to "Not configured": EventLog/Channel_LogMaxSize_2
$k = 'HKLM:\Software\Policies\Microsoft\Windows\EventLog\Security'
Remove-ItemProperty -Path $k -Name 'MaxSize' -ErrorAction SilentlyContinueOptions (1)
| Label | Control | Registry value | REG type | Constraints / details |
|---|---|---|---|---|
| Maximum Log Size (KB)Taille maximale du journal (Ko)Channel_LogMaxSize | Numeric boxdecimal | MaxSize | REG_DWORD | Required · Min: 20480 · Max: 2147483647 · Default (UI): 40960 |