Class LogGroupProps
Properties for a LogGroup.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.Logs
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class LogGroupProps : ILogGroupProps
Syntax (vb)
Public Class LogGroupProps Implements ILogGroupProps
Remarks
ExampleMetadata: fixture=default infused
Examples
var repository = new Repository(this, "TestRepository", new RepositoryProps {
RepositoryName = "test-agent-runtime"
});
var agentRuntimeArtifact = AgentRuntimeArtifact.FromEcrRepository(repository, "v1.0.0");
// Use a /aws/vendedlogs/ log group for same-account delivery without explicit resource policy
var logGroup = new LogGroup(this, "RuntimeLogGroup", new LogGroupProps {
LogGroupName = "/aws/vendedlogs/bedrock-agentcore/my-runtime"
});
new Runtime(this, "test-runtime", new RuntimeProps {
RuntimeName = "test_runtime",
AgentRuntimeArtifact = agentRuntimeArtifact,
TracingEnabled = true,
LoggingConfigs = new [] { new LoggingConfig {
LogType = LogType.APPLICATION_LOGS,
Destination = LoggingDestination.CloudWatchLogs(logGroup)
} },
ManageDeliveryResourcePolicy = false
});
Synopsis
Constructors
| LogGroupProps() | Properties for a LogGroup. |
Properties
| DataProtectionPolicy | Data Protection Policy for this log group. |
| DeletionProtectionEnabled | Indicates whether deletion protection is enabled for this log group. |
| EncryptionKey | The KMS customer managed key to encrypt the log group with. |
| FieldIndexPolicies | Field Index Policies for this log group. |
| LogGroupClass | The class of the log group. Possible values are: STANDARD, INFREQUENT_ACCESS and DELIVERY. |
| LogGroupName | Name of the log group. |
| RemovalPolicy | Determine the removal policy of this log group. |
| Retention | How long, in days, the log contents will be retained. |
Constructors
LogGroupProps()
Properties for a LogGroup.
public LogGroupProps()
Remarks
ExampleMetadata: fixture=default infused
Examples
var repository = new Repository(this, "TestRepository", new RepositoryProps {
RepositoryName = "test-agent-runtime"
});
var agentRuntimeArtifact = AgentRuntimeArtifact.FromEcrRepository(repository, "v1.0.0");
// Use a /aws/vendedlogs/ log group for same-account delivery without explicit resource policy
var logGroup = new LogGroup(this, "RuntimeLogGroup", new LogGroupProps {
LogGroupName = "/aws/vendedlogs/bedrock-agentcore/my-runtime"
});
new Runtime(this, "test-runtime", new RuntimeProps {
RuntimeName = "test_runtime",
AgentRuntimeArtifact = agentRuntimeArtifact,
TracingEnabled = true,
LoggingConfigs = new [] { new LoggingConfig {
LogType = LogType.APPLICATION_LOGS,
Destination = LoggingDestination.CloudWatchLogs(logGroup)
} },
ManageDeliveryResourcePolicy = false
});
Properties
DataProtectionPolicy
Data Protection Policy for this log group.
public DataProtectionPolicy? DataProtectionPolicy { get; set; }
Property Value
Remarks
Default: - no data protection policy
DeletionProtectionEnabled
Indicates whether deletion protection is enabled for this log group.
public bool? DeletionProtectionEnabled { get; set; }
Property Value
bool?
Remarks
When enabled, deletion protection blocks all deletion operations until it is explicitly disabled.
Default: false
EncryptionKey
The KMS customer managed key to encrypt the log group with.
public IKeyRef? EncryptionKey { get; set; }
Property Value
Remarks
Default: Server-side encryption managed by the CloudWatch Logs service
FieldIndexPolicies
Field Index Policies for this log group.
public FieldIndexPolicy[]? FieldIndexPolicies { get; set; }
Property Value
Remarks
Default: - no field index policies for this log group.
LogGroupClass
The class of the log group. Possible values are: STANDARD, INFREQUENT_ACCESS and DELIVERY.
public LogGroupClass? LogGroupClass { get; set; }
Property Value
Remarks
INFREQUENT_ACCESS class provides customers a cost-effective way to consolidate logs which supports querying using Logs Insights. The logGroupClass property cannot be changed once the log group is created.
DELIVERY class is used to deliver logs to a destination such as Amazon S3 or Amazon
Data Firehose (for example, Lambda vended logs). A Delivery log group forwards events
to a destination instead of storing them, so it does not support retention,
dataProtectionPolicy, or fieldIndexPolicies; setting any of these together with
LogGroupClass.DELIVERY results in a synthesis-time error.
Default: LogGroupClass.STANDARD
LogGroupName
Name of the log group.
public string? LogGroupName { get; set; }
Property Value
Remarks
Default: Automatically generated
RemovalPolicy
Determine the removal policy of this log group.
public RemovalPolicy? RemovalPolicy { get; set; }
Property Value
Remarks
Normally you want to retain the log group so you can diagnose issues from logs even after a deployment that no longer includes the log group. In that case, use the normal date-based retention policy to age out your logs.
Default: RemovalPolicy.Retain
Retention
How long, in days, the log contents will be retained.
public RetentionDays? Retention { get; set; }
Property Value
Remarks
To retain all logs, set this value to RetentionDays.INFINITE.
Default: RetentionDays.TWO_YEARS