LoggingDestination Class
Represents a logging destination for AgentCore Runtime.
Use the static factory methods to create instances:
LoggingDestination.cloudWatchLogs(logGroup)- Send logs to CloudWatch LogsLoggingDestination.s3(bucket)- Send logs to S3LoggingDestination.firehose(stream)- Send logs to Kinesis Data Firehose
| Source | aws-bedrockagentcore/lib/runtime/observability.ts |
|---|---|
| Type last changed |
Example
ts
const repository = new ecr.Repository(this, 'TestRepository', {
repositoryName: 'test-agent-runtime',
});
const agentRuntimeArtifact = agentcore.AgentRuntimeArtifact.fromEcrRepository(repository, 'v1.0.0');
// Use a /aws/vendedlogs/ log group for same-account delivery without explicit resource policy
const logGroup = new logs.LogGroup(this, 'RuntimeLogGroup', {
logGroupName: '/aws/vendedlogs/bedrock-agentcore/my-runtime',
});
new agentcore.Runtime(this, 'test-runtime', {
runtimeName: 'test_runtime',
agentRuntimeArtifact: agentRuntimeArtifact,
tracingEnabled: true,
loggingConfigs: [
{
logType: agentcore.LogType.APPLICATION_LOGS,
destination: agentcore.LoggingDestination.cloudWatchLogs(logGroup),
},
],
manageDeliveryResourcePolicy: false,
});
python
repository = ecr.Repository(self, "TestRepository",
repository_name="test-agent-runtime"
)
agent_runtime_artifact = agentcore.AgentRuntimeArtifact.from_ecr_repository(repository, "v1.0.0")
# Use a /aws/vendedlogs/ log group for same-account delivery without explicit resource policy
log_group = logs.LogGroup(self, "RuntimeLogGroup",
log_group_name="/aws/vendedlogs/bedrock-agentcore/my-runtime"
)
agentcore.Runtime(self, "test-runtime",
runtime_name="test_runtime",
agent_runtime_artifact=agent_runtime_artifact,
tracing_enabled=True,
logging_configs=[agentcore.LoggingConfig(
log_type=agentcore.LogType.APPLICATION_LOGS,
destination=agentcore.LoggingDestination.cloud_watch_logs(log_group)
)
],
manage_delivery_resource_policy=False
)
java
Repository repository = Repository.Builder.create(this, "TestRepository")
.repositoryName("test-agent-runtime")
.build();
AgentRuntimeArtifact agentRuntimeArtifact = AgentRuntimeArtifact.fromEcrRepository(repository, "v1.0.0");
// Use a /aws/vendedlogs/ log group for same-account delivery without explicit resource policy
LogGroup logGroup = LogGroup.Builder.create(this, "RuntimeLogGroup")
.logGroupName("/aws/vendedlogs/bedrock-agentcore/my-runtime")
.build();
Runtime.Builder.create(this, "test-runtime")
.runtimeName("test_runtime")
.agentRuntimeArtifact(agentRuntimeArtifact)
.tracingEnabled(true)
.loggingConfigs(List.of(LoggingConfig.builder()
.logType(LogType.APPLICATION_LOGS)
.destination(LoggingDestination.cloudWatchLogs(logGroup))
.build()))
.manageDeliveryResourcePolicy(false)
.build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
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
});
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
repository := ecr.NewRepository(this, jsii.String("TestRepository"), &RepositoryProps{
RepositoryName: jsii.String("test-agent-runtime"),
})
agentRuntimeArtifact := agentcore.AgentRuntimeArtifact_FromEcrRepository(repository, jsii.String("v1.0.0"))
// Use a /aws/vendedlogs/ log group for same-account delivery without explicit resource policy
logGroup := logs.NewLogGroup(this, jsii.String("RuntimeLogGroup"), &LogGroupProps{
LogGroupName: jsii.String("/aws/vendedlogs/bedrock-agentcore/my-runtime"),
})
agentcore.NewRuntime(this, jsii.String("test-runtime"), &RuntimeProps{
RuntimeName: jsii.String("test_runtime"),
AgentRuntimeArtifact: agentRuntimeArtifact,
TracingEnabled: jsii.Boolean(true),
LoggingConfigs: []LoggingConfig{
&LoggingConfig{
LogType: agentcore.LogType_APPLICATION_LOGS(),
Destination: agentcore.LoggingDestination_CloudWatchLogs(logGroup),
},
},
ManageDeliveryResourcePolicy: jsii.Boolean(false),
})
Initializer
ts
new LoggingDestination()
python
LoggingDestination()
java
new LoggingDestination()
csharp
new LoggingDestination()
go
NewLoggingDestination()
Methods
cloudWatchLogs(logGroup: ILogGroup): LoggingDestination // chainable@staticmethod def cloud_watch_logs(log_group: ILogGroup) -> LoggingDestinationpublic static LoggingDestination cloudWatchLogs(ILogGroup logGroup)public static LoggingDestination CloudWatchLogs(ILogGroup logGroup)func CloudWatchLogs(LogGroup ILogGroup) LoggingDestination static #Create a logging destination that sends logs to a CloudWatch Log Group.
1 parameter
Parameters
logGrouplog_grouplogGrouplogGroupLogGroup— The CloudWatch Log Group to send logs to.
firehose(stream: IDeliveryStream): LoggingDestination // chainable@staticmethod def firehose(stream: IDeliveryStream) -> LoggingDestinationpublic static LoggingDestination firehose(IDeliveryStream stream)public static LoggingDestination Firehose(IDeliveryStream stream)func Firehose(Stream IDeliveryStream) LoggingDestination static #Create a logging destination that sends logs to a Kinesis Data Firehose delivery stream.
1 parameter
Parameters
streamstreamstreamstreamStream— The Firehose delivery stream to send logs to.
s3(bucket: IBucket): LoggingDestination // chainable@staticmethod def s3(bucket: IBucket) -> LoggingDestinationpublic static LoggingDestination s3(IBucket bucket)public static LoggingDestination S3(IBucket bucket)func S3(Bucket IBucket) LoggingDestination static #Create a logging destination that sends logs to an S3 bucket.
1 parameter
Parameters
bucketbucketbucketbucketBucket— The S3 bucket to send logs to.