AWS::Logs::LogStream
The AWS::Logs::LogStream
resource specifies an Amazon CloudWatch Logs log stream in a specific log group.
A log stream represents the sequence of events coming from an application instance or resource that you are monitoring.
There is no limit on the number of log streams that you can create for a log group.
You must use the following guidelines when naming a log stream:
-
Log stream names must be unique within the log group.
-
Log stream names can be between 1 and 512 characters long.
-
The ':' (colon) and '*' (asterisk) characters are not allowed.
Syntax
To declare this entity in your AWS CloudFormation template, use the following syntax:
JSON
{ "Type" : "AWS::Logs::LogStream", "Properties" : { "LogGroupName" :
String
, "LogStreamName" :String
} }
YAML
Type: AWS::Logs::LogStream Properties: LogGroupName:
String
LogStreamName:String
Properties
LogGroupName
-
The name of the log group where the log stream is created.
Required: Yes
Type: String
Pattern:
[\.\-_/#A-Za-z0-9]+
Minimum:
1
Maximum:
512
Update requires: Replacement
LogStreamName
-
The name of the log stream. The name must be unique within the log group.
Required: No
Type: String
Pattern:
[^:*]*
Minimum:
1
Maximum:
512
Update requires: Replacement
Return values
Ref
When you pass the logical ID of this resource to the intrinsic Ref
function, Ref
returns the resource name, such as MyAppLogStream
.
For more information about using the Ref
function, see Ref
.
Examples
Create a Log Stream
The following example creates a log stream named MyAppLogStream
in
the exampleLogGroup
log group.
JSON
"LogStream": { "Type": "AWS::Logs::LogStream", "Properties": { "LogGroupName" : "exampleLogGroup", "LogStreamName": "MyAppLogStream" } }
YAML
LogStream: Type: AWS::Logs::LogStream Properties: LogGroupName: "exampleLogGroup" LogStreamName: "MyAppLogStream"