Class LogRetention
Creates a custom resource to control the retention policy of a CloudWatch Logs log group.
Inherited Members
Namespace: Amazon.CDK.AWS.Logs
Assembly: Amazon.CDK.AWS.Logs.dll
Syntax (csharp)
public class LogRetention : Construct, IConstruct, IDependable
Syntax (vb)
Public Class LogRetention
Inherits Construct
Implements IConstruct, IDependable
Remarks
The log group is created if it doesn't already exist. The policy
is removed when retentionDays
is undefined
or equal to Infinity
.
Log group can be created in the region that is different from stack region by
specifying logGroupRegion
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.IAM;
using Amazon.CDK.AWS.Logs;
using Amazon.CDK;
Role role;
var logRetention = new LogRetention(this, "MyLogRetention", new LogRetentionProps {
LogGroupName = "logGroupName",
Retention = RetentionDays.ONE_DAY,
// the properties below are optional
LogGroupRegion = "logGroupRegion",
LogRetentionRetryOptions = new LogRetentionRetryOptions {
Base = Duration.Minutes(30),
MaxRetries = 123
},
Role = role
});
Synopsis
Constructors
LogRetention(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
LogRetention(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
LogRetention(Construct, String, ILogRetentionProps) |
Properties
LogGroupArn | The ARN of the LogGroup. |
Constructors
LogRetention(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected LogRetention(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
LogRetention(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected LogRetention(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
LogRetention(Construct, String, ILogRetentionProps)
public LogRetention(Construct scope, string id, ILogRetentionProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props ILogRetentionProps
Properties
LogGroupArn
The ARN of the LogGroup.
public virtual string LogGroupArn { get; }
Property Value
System.String