Skip to main content

log_streams

Creates, updates, deletes, gets or lists a log_streams resource.

Overview

Namelog_streams
TypeResource
Idaws.logs.log_streams

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
arnstringThe Amazon Resource Name (ARN) of the log stream.
creation_timeinteger (int64)The creation time of the stream, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
first_event_timestampinteger (int64)The time of the first event, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.
last_event_timestampinteger (int64)The time of the most recent log event in the log stream in CloudWatch Logs. This number is expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC. The lastEventTime value updates on an eventual consistency basis. It typically updates in less than an hour from ingestion, but in rare situations might take longer.
last_ingestion_timeinteger (int64)The ingestion time, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC The lastIngestionTime value updates on an eventual consistency basis. It typically updates in less than an hour after ingestion, but in rare situations might take longer.
log_stream_namestringThe name of the log stream. (pattern: <code>[^:]</code>)
stored_bytesinteger (int64)The number of bytes stored. Important: As of June 17, 2019, this parameter is no longer supported for log streams, and is always reported as zero. This change applies only to log streams. The storedBytes parameter for log groups is not affected.
upload_sequence_tokenstringThe sequence token. The sequence token is now ignored in PutLogEvents actions. PutLogEvents actions are always accepted regardless of receiving an invalid sequence token. You don't need to obtain uploadSequenceToken to use a PutLogEvents action.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_log_streamsselectregionLists the log streams for the specified log group. You can list all the log streams or filter the results by prefix. You can also control how the results are ordered. You can specify the log group to search by using either logGroupIdentifier or logGroupName. You must include one of these two parameters, but you can't include both. This operation has a limit of 25 transactions per second, after which transactions are throttled. If you are using CloudWatch cross-account observability, you can use this operation in a monitoring account and view data from the linked source accounts. For more information, see CloudWatch cross-account observability.
create_log_streaminsertregion, logGroupName, logStreamNameCreates a log stream for the specified log group. A log stream is a sequence of log events that originate from a single source, such as an application instance or a resource that is being monitored. There is no limit on the number of log streams that you can create for a log group. There is a limit of 50 TPS on CreateLogStream operations, after which transactions are throttled. 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. Don't use ':' (colon) or '*' (asterisk) characters.
delete_log_streamdeleteregionDeletes the specified log stream and permanently deletes all the archived log events associated with the log stream.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Lists the log streams for the specified log group. You can list all the log streams or filter the results by prefix. You can also control how the results are ordered. You can specify the log group to search by using either logGroupIdentifier or logGroupName. You must include one of these two parameters, but you can't include both. This operation has a limit of 25 transactions per second, after which transactions are throttled. If you are using CloudWatch cross-account observability, you can use this operation in a monitoring account and view data from the linked source accounts. For more information, see CloudWatch cross-account observability.

SELECT
arn,
creation_time,
first_event_timestamp,
last_event_timestamp,
last_ingestion_time,
log_stream_name,
stored_bytes,
upload_sequence_token
FROM aws.logs.log_streams
WHERE region = '{{ region }}' -- required
;

INSERT examples

Creates a log stream for the specified log group. A log stream is a sequence of log events that originate from a single source, such as an application instance or a resource that is being monitored. There is no limit on the number of log streams that you can create for a log group. There is a limit of 50 TPS on CreateLogStream operations, after which transactions are throttled. 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. Don't use ':' (colon) or '*' (asterisk) characters.

INSERT INTO aws.logs.log_streams (
logGroupName,
logStreamName,
region
)
SELECT
'{{ logGroupName }}' /* required */,
'{{ logStreamName }}' /* required */,
'{{ region }}'
;

DELETE examples

Deletes the specified log stream and permanently deletes all the archived log events associated with the log stream.

DELETE FROM aws.logs.log_streams
WHERE region = '{{ region }}' --required
;