Skip to content

describe_log_streams async

describe_log_streams(
    *,
    config_overrides: Optional[AsyncCloudWatchLogsClientConfig] = None,
    log_group_name: Optional[LogGroupName] = None,
    log_group_identifier: Optional[LogGroupIdentifier] = None,
    log_stream_name_prefix: Optional[LogStreamName] = None,
    order_by: Optional[OrderBy] = None,
    descending: Optional[Descending] = None,
    next_token: Optional[NextToken] = None,
    limit: Optional[DescribeLimit] = None,
) -> DescribeLogStreamsResponse

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.

Parameters:

  • log_group_name (Optional[LogGroupName], default: None ) –

    The name of the log group.

    You must include either logGroupIdentifier or logGroupName, but not both.

  • log_group_identifier (Optional[LogGroupIdentifier], default: None ) –

    Specify either the name or ARN of the log group to view. If the log group is in a source account and you are using a monitoring account, you must use the log group ARN.

    You must include either logGroupIdentifier or logGroupName, but not both.

  • log_stream_name_prefix (Optional[LogStreamName], default: None ) –

    The prefix to match.

    If orderBy is LastEventTime, you cannot specify this parameter.

  • order_by (Optional[OrderBy], default: None ) –

    If the value is LogStreamName, the results are ordered by log stream name. If the value is LastEventTime, the results are ordered by the event time. The default value is LogStreamName.

    If you order the results by event time, you cannot specify the logStreamNamePrefix parameter.

    lastEventTimestamp represents 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. lastEventTimestamp updates on an eventual consistency basis. It typically updates in less than an hour from ingestion, but in rare situations might take longer.

  • descending (Optional[Descending], default: None ) –

    If the value is true, results are returned in descending order. If the value is to false, results are returned in ascending order. The default value is false.

  • next_token (Optional[NextToken], default: None ) –

    The token for the next set of items to return. (You received this token from a previous call.)

  • limit (Optional[DescribeLimit], default: None ) –

    The maximum number of items returned. If you don't specify a value, the default is up to 50 items.

Raises:

Source code in docs_src/capo_cloudwatch_logs/_services/async_cloud_watch_logs.py
async def describe_log_streams(
    self,
    *,
    config_overrides: Optional[AsyncCloudWatchLogsClientConfig] = None,
    log_group_name: Optional[
        "capo_cloudwatch_logs.types.log_group_name.LogGroupName"
    ] = None,
    log_group_identifier: Optional[
        "capo_cloudwatch_logs.types.log_group_identifier.LogGroupIdentifier"
    ] = None,
    log_stream_name_prefix: Optional[
        "capo_cloudwatch_logs.types.log_stream_name.LogStreamName"
    ] = None,
    order_by: Optional["capo_cloudwatch_logs.types.order_by.OrderBy"] = None,
    descending: Optional["capo_cloudwatch_logs.types.descending.Descending"] = None,
    next_token: Optional["capo_cloudwatch_logs.types.next_token.NextToken"] = None,
    limit: Optional[
        "capo_cloudwatch_logs.types.describe_limit.DescribeLimit"
    ] = None,
) -> "capo_cloudwatch_logs.types.describe_log_streams_response.DescribeLogStreamsResponse":
    """<p>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.</p> <p>You can specify the log group to search by using either <code>logGroupIdentifier</code> or <code>logGroupName</code>. You must include one of these two parameters, but you can't include both. </p> <p>This operation has a limit of 25 transactions per second, after which transactions are throttled.</p> <p>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 <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/CloudWatch-Unified-Cross-Account.html">CloudWatch cross-account observability</a>.</p>

    Args:
        log_group_name: <p>The name of the log group.</p> <note> <p> You must include either <code>logGroupIdentifier</code> or <code>logGroupName</code>, but not both. </p> </note>
        log_group_identifier: <p>Specify either the name or ARN of the log group to view. If the log group is in a source account and you are using a monitoring account, you must use the log group ARN.</p> <note> <p> You must include either <code>logGroupIdentifier</code> or <code>logGroupName</code>, but not both. </p> </note>
        log_stream_name_prefix: <p>The prefix to match.</p> <p>If <code>orderBy</code> is <code>LastEventTime</code>, you cannot specify this parameter.</p>
        order_by: <p>If the value is <code>LogStreamName</code>, the results are ordered by log stream name. If the value is <code>LastEventTime</code>, the results are ordered by the event time. The default value is <code>LogStreamName</code>.</p> <p>If you order the results by event time, you cannot specify the <code>logStreamNamePrefix</code> parameter.</p> <p> <code>lastEventTimestamp</code> represents 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 <code>Jan 1, 1970 00:00:00 UTC</code>. <code>lastEventTimestamp</code> updates on an eventual consistency basis. It typically updates in less than an hour from ingestion, but in rare situations might take longer.</p>
        descending: <p>If the value is true, results are returned in descending order. If the value is to false, results are returned in ascending order. The default value is false.</p>
        next_token: <p>The token for the next set of items to return. (You received this token from a previous call.)</p>
        limit: <p>The maximum number of items returned. If you don't specify a value, the default is up to 50 items.</p>

    Raises:
        capo_cloudwatch_logs.errors.invalid_parameter_exception.InvalidParameterException: <p>A parameter is specified incorrectly.</p>
        capo_cloudwatch_logs.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
        capo_cloudwatch_logs.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service cannot complete the request.</p>
        capo_cloudwatch_logs.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_cloudwatch_logs.types.describe_log_streams_request.DescribeLogStreamsRequest]",
    ) -> AsyncOperationResponse[
        "capo_cloudwatch_logs.types.describe_log_streams_response.DescribeLogStreamsResponse"
    ]:
        import capo_cloudwatch_logs._operations.logs_20140328.describe_log_streams

        (
            output,
            http_response,
        ) = await capo_cloudwatch_logs._operations.logs_20140328.describe_log_streams.async_describe_log_streams(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DescribeLogStreams")
    )
    input_: capo_cloudwatch_logs.types.describe_log_streams_request.DescribeLogStreamsRequest = {}
    if log_group_name is not None:
        input_["log_group_name"] = log_group_name
    if log_group_identifier is not None:
        input_["log_group_identifier"] = log_group_identifier
    if log_stream_name_prefix is not None:
        input_["log_stream_name_prefix"] = log_stream_name_prefix
    if order_by is not None:
        input_["order_by"] = order_by
    if descending is not None:
        input_["descending"] = descending
    if next_token is not None:
        input_["next_token"] = next_token
    if limit is not None:
        input_["limit"] = limit

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output