Skip to content

CloudWatchLogsClient.start_query

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

Model summary (excerpt): Starts a query of one or more log groups or data sources using CloudWatch Logs Insights. You specify the log groups or data sources and time range to query and the query string to use. You can query up to 10 data sources in a single query. For more information, see CloudWatch Logs Insights Query Syntax . After you run a query using StartQuery , the query results are stored by CloudWatch Logs....

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 (
    QueryLanguage,
    StartQueryOutput,
)

Signature

async def start_query(
    *,
    start_time: int,
    end_time: int,
    query_string: str,
    query_language: QueryLanguage | None = None,
    log_group_name: str | None = None,
    log_group_names: Sequence[str] | None = None,
    log_group_identifiers: Sequence[str] | None = None,
    limit: int | None = None,
) -> StartQueryOutput: ...

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)
start_time Yes The beginning of the time range to query. The range is inclusive, so the specified start time is included in the query. Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC .
end_time Yes The end of the time range to query. The range is inclusive, so the specified end time is included in the query. Specified as epoch time, the number of seconds since January 1, 1970, 00:00:00 UTC .
query_string Yes The query string to use. For more information, see CloudWatch Logs Insights Query Syntax .
query_language No Specify the query language to use for this query. The options are Logs Insights QL, OpenSearch PPL, and OpenSearch SQL. For more information about the query languages that CloudWatch Logs supports, see Supported query languages .
log_group_name No The log group on which to perform the query. A StartQuery operation must include exactly one of the following parameters: logGroupName , logGroupNames , or logGroupIdentifiers . The exception is queries using the OpenSearch Service SQL query language, where you specify the log group names inside the querystring instead of here.
log_group_names No The list of log groups to be queried. You can include up to 50 log groups. A StartQuery operation must include exactly one of the following parameters: logGroupName , logGroupNames , or logGroupIdentifiers . The exception is queries using the OpenSearch Service SQL query language, where you specify the log group names inside the querystring instead of here.
log_group_identifiers No The list of log groups to query. You can include up to 50 log groups. You can specify them by the log group name or ARN. If a log group that you're querying is in a source account and you're using a monitoring account, you must specify the ARN of the log group here. The query definition must also be defined in the monitoring account. If you specify an ARN, use the format arn:aws:logs: region :...
limit No The maximum number of log events to return from the query. The maximum limit is 100,000. The maximum events returned in a single GetQueryResults API call is 10,000 log events per request. You can retrieve up to 100,000 log event results from a query by paginating with the nextToken . 100,000 limit is only supported for Logs Insights QL and is currently not supported for PPL and SQL query...

Output

StartQueryOutput.

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
query_id 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.

QueryLanguage, StartQueryOutput

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

Pagination and streaming

No generated paginator for this operation.

No output stream.

Errors

Import from rboto_cloudwatch_logs.exceptions:

InvalidParameterError, LimitExceededError, MalformedQueryError, ResourceNotFoundError, ServiceUnavailableError.

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

Service guide · Pinned model