CloudWatchLogsClient.create_scheduled_query
rboto-cloudwatch-logs==0.4.0 · Service index · Types
Model summary (excerpt): Creates a scheduled query that runs CloudWatch Logs Insights queries at regular intervals. Scheduled queries enable proactive monitoring by automatically executing queries to detect patterns and anomalies in your log data. Query results can be delivered to Amazon S3 for analysis or further processing.
Install and imports
from rboto import CloudWatchLogsClient
from collections.abc import Sequence
from rboto_cloudwatch_logs.types import (
CreateScheduledQueryOutput,
DestinationConfiguration,
QueryLanguage,
ScheduledQueryState,
)
Signature
async def create_scheduled_query(
*,
name: str,
query_language: QueryLanguage,
query_string: str,
schedule_expression: str,
execution_role_arn: str,
description: str | None = None,
log_group_identifiers: Sequence[str] | None = None,
timezone: str | None = None,
start_time_offset: int | None = None,
end_time_offset: int | None = None,
destination_configuration: DestinationConfiguration | None = None,
schedule_start_time: int | None = None,
schedule_end_time: int | None = None,
state: ScheduledQueryState | None = None,
tags: dict[str, str] | None = None,
) -> CreateScheduledQueryOutput: ...
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) |
|---|---|---|
name |
Yes | The name of the scheduled query. The name must be unique within your account and region. Length must be between 1 and 300 characters. |
query_language |
Yes | The query language to use for the scheduled query. Valid values are CWLI , PPL , and SQL . |
query_string |
Yes | The query string to execute. This is the same query syntax used in CloudWatch Logs Insights. Maximum length is 10,000 characters. |
schedule_expression |
Yes | A cron expression that defines when the scheduled query runs. The expression uses standard cron syntax and supports minute-level precision. Maximum length is 256 characters. |
execution_role_arn |
Yes | The ARN of the IAM role that grants permissions to execute the query and deliver results to the specified destination. The role must have permissions to read from the specified log groups and write to the destination. |
description |
No | An optional description for the scheduled query to help identify its purpose and functionality. |
log_group_identifiers |
No | An array of log group names or ARNs to query. You can specify between 1 and 50 log groups. Log groups can be identified by name or full ARN. |
timezone |
No | The timezone for evaluating the schedule expression. This determines when the scheduled query executes relative to the specified timezone. |
start_time_offset |
No | The time offset in seconds that defines the lookback period for the query. This determines how far back in time the query searches from the execution time. |
end_time_offset |
No | The time offset in seconds that defines the end of the lookback period for the query. Together with startTimeOffset , this determines the time window relative to the execution time over which the query runs. |
destination_configuration |
No | Configuration for where to deliver query results. Supports Amazon S3 destinations for storing query output and lookup table destinations for automatically refreshing lookup tables with query results. You can configure one or both destination types. |
schedule_start_time |
No | The start time for the scheduled query in Unix epoch format. The query will not execute before this time. |
schedule_end_time |
No | The end time for the scheduled query in Unix epoch format. The query will stop executing after this time. |
state |
No | The initial state of the scheduled query. Valid values are ENABLED and DISABLED . Default is ENABLED . |
tags |
No | Key-value pairs to associate with the scheduled query for resource management and cost allocation. |
Output
CreateScheduledQueryOutput.
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 |
|---|---|---|---|
scheduled_query_arn |
str | None |
Always present | — |
state |
ScheduledQueryStateOutput | None |
Always present | ScheduledQueryStateOutput |
| 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.
Related types
CreateScheduledQueryOutput, DestinationConfiguration, QueryLanguage, ScheduledQueryState
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:
AccessDeniedError, ConflictError, InternalServerError, ResourceNotFoundError, ServiceQuotaExceededError, ThrottlingError, ValidationError.
Other service failures use the service base error; credential, transport and timeout failures use shared errors.