Redigera

Dela via


New-AzDiagnosticSettingLogSettingsObject

Create an in-memory object for LogSettings.

Syntax

New-AzDiagnosticSettingLogSettingsObject
   -Enabled <Boolean>
   [-Category <String>]
   [-CategoryGroup <String>]
   [-RetentionPolicyDay <Int32>]
   [-RetentionPolicyEnabled <Boolean>]
   [<CommonParameters>]

Description

Create an in-memory object for LogSettings.

Examples

Example 1: Create log setting object

New-AzDiagnosticSettingLogSettingsObject -Enabled $true -Category ContainerEventLogs -RetentionPolicyDay 7 -RetentionPolicyEnabled $true

Create log setting object, to get supported categories for resource, please see Get-AzDiagnosticSettingCategory

Parameters

-Category

Name of a Diagnostic Log category for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-CategoryGroup

Name of a Diagnostic Log category group for a resource type this setting is applied to. To obtain the list of Diagnostic Log categories for a resource, first perform a GET diagnostic settings operation.

Type:String
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-Enabled

a value indicating whether this log is enabled.

Type:Boolean
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-RetentionPolicyDay

the number of days for the retention in days. A value of 0 will retain the events indefinitely.

Type:Int32
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-RetentionPolicyEnabled

a value indicating whether the retention policy is enabled.

Type:Boolean
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Outputs

LogSettings