Skip to content
v2.277.0

LogStreamProps Struct ​

Properties for a LogStream.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_logs as logs } from 'aws-cdk-lib';
import { aws_logs as interfaces_logs } from 'aws-cdk-lib/interfaces';

declare const logGroupRef: interfaces_logs.ILogGroupRef;
const logStreamProps: logs.LogStreamProps = {
  logGroup: logGroupRef,

  // the properties below are optional
  logStreamName: 'logStreamName',
  removalPolicy: cdk.RemovalPolicy.DESTROY,
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk as cdk
from aws_cdk import aws_logs as logs
from aws_cdk.interfaces import aws_logs as interfaces_logs

# log_group_ref: interfaces_logs.ILogGroupRef

log_stream_props = logs.LogStreamProps(
    log_group=log_group_ref,

    # the properties below are optional
    log_stream_name="logStreamName",
    removal_policy=cdk.RemovalPolicy.DESTROY
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.*;
import software.amazon.awscdk.services.logs.*;
import software.amazon.awscdk.interfaces.logs.*;

ILogGroupRef logGroupRef;

LogStreamProps logStreamProps = LogStreamProps.builder()
        .logGroup(logGroupRef)

        // the properties below are optional
        .logStreamName("logStreamName")
        .removalPolicy(RemovalPolicy.DESTROY)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK;
using Amazon.CDK.AWS.Logs;
using Amazon.CDK.Interfaces.Logs;

ILogGroupRef logGroupRef;

var logStreamProps = new LogStreamProps {
    LogGroup = logGroupRef,

    // the properties below are optional
    LogStreamName = "logStreamName",
    RemovalPolicy = RemovalPolicy.DESTROY
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import cdk "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var logGroupRef ILogGroupRef

logStreamProps := &LogStreamProps{
	LogGroup: logGroupRef,

	// the properties below are optional
	LogStreamName: jsii.String("logStreamName"),
	RemovalPolicy: cdk.RemovalPolicy_DESTROY,
}

Properties ​

logGroupILogGroupReflog_groupILogGroupReflogGroupILogGroupRefLogGroupILogGroupRefLogGroupILogGroupRef required #
The log group to create a log stream for.
logStreamNameoptionalstringlog_stream_nameoptionalstrlogStreamNameoptionalStringLogStreamNameoptionalstringLogStreamNameoptional*string #
The name of the log stream to create.

Default: Automatically generated

The name must be unique within the log group.

removalPolicyoptionalRemovalPolicyremoval_policyoptionalRemovalPolicyremovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicyRemovalPolicyoptionalRemovalPolicy = RemovalPolicy.Retain #
Determine what happens when the log stream resource is removed from the app.

Normally you want to retain the log stream so you can diagnose issues from logs even after a deployment that no longer includes the log stream.

The date-based retention policy of your log group will age out the logs after a certain time.