Skip to content

CloudWatchLogsClient.filter_log_events

rboto-cloudwatch-logs==0.4.0 · Service index · Types

Model summary (excerpt): Lists log events from the specified log group. You can list all the log events or filter the results using one or more of the following: A filter pattern A time range The log stream name, or a log stream name prefix that matches multiple log streams You must have the logs:FilterLogEvents permission to perform this operation. You can specify the log group to search by using either...

Install and imports

python -m pip install "rboto[cloudwatch-logs]==0.4.0"
from rboto import CloudWatchLogsClient
from collections.abc import Sequence
from rboto_cloudwatch_logs.types import (
    FilterLogEventsOutput,
)

Signature

async def filter_log_events(
    *,
    log_group_name: str | None = None,
    log_group_identifier: str | None = None,
    log_stream_names: Sequence[str] | None = None,
    log_stream_name_prefix: str | None = None,
    start_time: int | None = None,
    end_time: int | None = None,
    filter_pattern: str | None = None,
    next_token: str | None = None,
    limit: int | None = None,
    start_from_head: bool | None = None,
    interleaved: bool | None = None,
    unmask: bool | None = None,
) -> FilterLogEventsOutput: ...

Arguments without defaults are required. None omits an optional request argument. Static types do not validate resource existence, permissions, lengths, ranges, or conditional service requirements.

Arguments

Argument Required Model notes (excerpt)
log_group_name No The name of the log group to search. You must include either logGroupIdentifier or logGroupName , but not both.
log_group_identifier No Specify either the name or ARN of the log group to view log events from. 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_names No Filters the results to only logs from the log streams in this list. If you specify a value for both logStreamNames and logStreamNamePrefix , the action returns an InvalidParameterException error.
log_stream_name_prefix No Filters the results to include only events from log streams that have names starting with this prefix. If you specify a value for both logStreamNamePrefix and logStreamNames , the action returns an InvalidParameterException error.
start_time No The start of the time range, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC . Events with a timestamp before this time are not returned. Set startTime explicitly to reduce the chances of empty pages in the response.
end_time No The end of the time range, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC . Events with a timestamp later than this time are not returned.
filter_pattern No The filter pattern to use. For more information, see Filter and Pattern Syntax . If not provided, all the events are matched.
next_token No The token for the next set of events to return. (You received this token from a previous call.)
limit No The maximum number of events to return. The default is 10,000 events.
start_from_head No If the value is true, the earliest log events are returned first. If the value is false, the latest log events are returned first. The default value is true. The startFromHead parameter sets the sort direction on the first request. On subsequent requests, the nextToken determines the sort direction. To continue paginating in the same direction, provide the returned nextToken . If you provide...
interleaved No If the value is true, the operation attempts to provide responses that contain events from multiple log streams within the log group, interleaved in a single response. If the value is false, all the matched log events in the first log stream are searched first, then those in the next log stream, and so on. Important As of June 17, 2019, this parameter is ignored and the value is assumed to be...
unmask No Specify true to display the log event fields with all sensitive data unmasked and visible. The default is false . To use this operation with this parameter, you must be signed into an account with the logs:Unmask permission.

Output

FilterLogEventsOutput.

Read-only native attributes, accessed as response.field. Collection getters materialize Python values; to_dict() recursively materializes a mapping. Streams are consumed once.

Field Type Presence References
events list[FilteredLogEventOutput] | None Always present FilteredLogEventOutput
searched_log_streams list[SearchedLogStreamOutput] | None Always present SearchedLogStreamOutput
next_token str | None Always present —

| None means a value can be absent. Output mappings include every declared key; optional input keys may be omitted. Unknown output enum/union variants are not automatically valid inputs.

FilterLogEventsOutput

Follow these links for nested inputs and outputs; recursive types link back to the same type page.

Pagination and streaming

client.paginators.filter_log_events(...) accepts the same arguments and returns AsyncIterator[FilterLogEventsOutput]. Direct calls return one page. Pages preserve the Output representation above.

Input cursors: next_token. Page-size argument: limit.

No output stream.

Errors

Import from rboto_cloudwatch_logs.exceptions:

InvalidParameterError, ResourceNotFoundError, ServiceUnavailableError.

Other service failures use the service base error; credential, transport and timeout failures use shared errors.

Service guide · Pinned model