AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

LogStream

Define a Log Stream in a Log Group.

Import

import { LogStream } from 'aws-cdk-lib/aws-logs';

Or use the module namespace:

import * as logs from 'aws-cdk-lib/aws-logs';
// logs.LogStream

Properties

Configuration passed to the constructor as LogStreamProps.

logGroupRequired
ILogGroupRef

The log group to create a log stream for.

logStreamNameOptional
string

The name of the log stream to create. The name must be unique within the log group.

Default: Automatically generated

removalPolicyOptional
RemovalPolicy

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.

Default: RemovalPolicy.Retain

Learn AWS the Practical Way

Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.

Subscribe to Newsletter