Control Event Log behavior when the log file reaches its maximum size
Contrôler le comportement du journal des événements lorsque le fichier journal atteint sa taille maximale.
Explanation
This policy setting controls Event Log behavior when the log file reaches its maximum size.
If you enable this policy setting and a log file reaches its maximum size, new events are not written to the log and are lost.
If you disable or do not configure this policy setting and a log file reaches its maximum size, new events overwrite old events.
Note: Old events may or may not be retained according to the "Backup log automatically when full" policy setting.
Ce paramètre de stratégie contrôle le comportement du journal des événements lorsque le fichier journal atteint sa taille maximale.
Si vous activez ce paramètre de stratégie et qu’un fichier journal atteint sa taille maximale, les nouveaux événements ne sont pas écrits dans le journal et sont perdus.
Si vous désactivez ce paramètre de stratégie ou ne le configurez pas et qu’un fichier journal atteint sa taille maximale, les nouveaux événements remplacent les anciens.
Remarque : la conservation ou non des anciens événements dépend du paramètre de stratégie « Sauvegarder le journal automatiquement lorsqu’il est plein ».
Registry
HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\EventLog\Setup- Value name
Retention
| State | Value written |
|---|---|
| Enabled | REG_SZ = 1 |
| Disabled | REG_SZ = 0 |
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_Log_Retention_3
$k = 'HKLM:\Software\Policies\Microsoft\Windows\EventLog\Setup'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'Retention' -Value '1' -Type StringDisable
# Disable: EventLog/Channel_Log_Retention_3
$k = 'HKLM:\Software\Policies\Microsoft\Windows\EventLog\Setup'
if (-not (Test-Path -Path $k)) { New-Item -Path $k -Force | Out-Null }
Set-ItemProperty -Path $k -Name 'Retention' -Value '0' -Type StringRevert to "Not configured"
# Revert to "Not configured": EventLog/Channel_Log_Retention_3
$k = 'HKLM:\Software\Policies\Microsoft\Windows\EventLog\Setup'
Remove-ItemProperty -Path $k -Name 'Retention' -ErrorAction SilentlyContinue