System.Diagnostics.EventLog.MinimumRetentionDays Property

Gets the number of days to retain entries in the event log.

Syntax

[System.ComponentModel.Browsable(false)]
[System.MonoTODO]
[System.Runtime.InteropServices.ComVisible(false)]
public int MinimumRetentionDays { get; }

Value

Documentation for this section has not yet been entered.

Remarks

Use the EventLog.MinimumRetentionDays property to examine the current setting for an event log. Use EventLog.ModifyOverflowPolicy(OverflowAction, int) to change the minimum number of days that each entry in the event log must be retained.

The EventLog.MinimumRetentionDays value depends on the configured overflow behavior of the event log. If the System.Diagnostics.OverflowAction property for an event log is set to OverflowAction.OverwriteAsNeeded, then the EventLog.MinimumRetentionDays value is 0. If the System.Diagnostics.OverflowAction property for an event log is set to OverflowAction.DoNotOverwrite, then the EventLog.MinimumRetentionDays value is -1. If the System.Diagnostics.OverflowAction property for an event log is set to OverflowAction.OverwriteOlder, then the EventLog.MinimumRetentionDays value is greater than zero, and represents the number of days to retain event log entries when the event log is full.

The overflow behavior only occurs when an event log reaches its size limit. When an System.Diagnostics.EventLog has its EventLog.OverflowAction set to OverflowAction.OverwriteOlder, and the event log reaches its maximum size, then new entries are written only if they can replace entries whose age exceeds the EventLog.MinimumRetentionDays period. Retaining event entries for a minimum period is appropriate when the event log is archived regularly. Otherwise, you risk losing new entries when the event log reaches its limit. To avoid losing new event information, set the minimum retention days for events based on your archive schedule for a particular event log.

Requirements

Namespace: System.Diagnostics
Assembly: System (in System.dll)
Assembly Versions: 2.0.0.0, 4.0.0.0