2026/06/15 - Amazon CloudWatch Logs - 4 updated api methods
Changes Added endTimeOffset parameter to Scheduled Queries APIs (Create, Update, Get) enabling bounded time window configuration. Introduced scheduleType filter (CUSTOMER MANAGED, AWS MANAGED) for ListScheduledQueries and exposed it in Get and Update responses.
{'endTimeOffset': 'long'}
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.
See also: AWS API Documentation
Request Syntax
client.create_scheduled_query(
name='string',
description='string',
queryLanguage='CWLI'|'SQL'|'PPL',
queryString='string',
logGroupIdentifiers=[
'string',
],
scheduleExpression='string',
timezone='string',
startTimeOffset=123,
endTimeOffset=123,
destinationConfiguration={
's3Configuration': {
'destinationIdentifier': 'string',
'roleArn': 'string',
'ownerAccountId': 'string',
'kmsKeyId': 'string'
}
},
scheduleStartTime=123,
scheduleEndTime=123,
executionRoleArn='string',
state='ENABLED'|'DISABLED',
tags={
'string': 'string'
}
)
string
[REQUIRED]
The name of the scheduled query. The name must be unique within your account and region. Length must be between 1 and 300 characters.
string
An optional description for the scheduled query to help identify its purpose and functionality.
string
[REQUIRED]
The query language to use for the scheduled query. Valid values are CWLI, PPL, and SQL.
string
[REQUIRED]
The query string to execute. This is the same query syntax used in CloudWatch Logs Insights. Maximum length is 10,000 characters.
list
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.
(string) --
string
[REQUIRED]
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.
string
The timezone for evaluating the schedule expression. This determines when the scheduled query executes relative to the specified timezone.
integer
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.
integer
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.
dict
Configuration for where to deliver query results. Currently supports Amazon S3 destinations for storing query output.
s3Configuration (dict) -- [REQUIRED]
Configuration for delivering query results to Amazon S3.
destinationIdentifier (string) -- [REQUIRED]
The Amazon S3 URI where query results are delivered. Must be a valid S3 URI format.
roleArn (string) -- [REQUIRED]
The ARN of the IAM role that grants permissions to write query results to the specified Amazon S3 destination.
ownerAccountId (string) --
The Amazon Web Services accountId for the bucket owning account.
kmsKeyId (string) --
The Amazon Resource Name (ARN) of the KMS encryption key. Must belong to the same Amazon Web Services Region as the destination Amazon S3 bucket.
integer
The start time for the scheduled query in Unix epoch format. The query will not execute before this time.
integer
The end time for the scheduled query in Unix epoch format. The query will stop executing after this time.
string
[REQUIRED]
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.
string
The initial state of the scheduled query. Valid values are ENABLED and DISABLED. Default is ENABLED.
dict
Key-value pairs to associate with the scheduled query for resource management and cost allocation.
(string) --
(string) --
dict
Response Syntax
{
'scheduledQueryArn': 'string',
'state': 'ENABLED'|'DISABLED'
}
Response Structure
(dict) --
scheduledQueryArn (string) --
The ARN of the created scheduled query.
state (string) --
The current state of the scheduled query.
{'endTimeOffset': 'long', 'scheduleType': 'CUSTOMER_MANAGED | AWS_MANAGED'}
Retrieves details about a specific scheduled query, including its configuration, execution status, and metadata.
See also: AWS API Documentation
Request Syntax
client.get_scheduled_query(
identifier='string'
)
string
[REQUIRED]
The ARN or name of the scheduled query to retrieve.
dict
Response Syntax
{
'scheduledQueryArn': 'string',
'name': 'string',
'description': 'string',
'queryLanguage': 'CWLI'|'SQL'|'PPL',
'queryString': 'string',
'logGroupIdentifiers': [
'string',
],
'scheduleExpression': 'string',
'timezone': 'string',
'startTimeOffset': 123,
'endTimeOffset': 123,
'destinationConfiguration': {
's3Configuration': {
'destinationIdentifier': 'string',
'roleArn': 'string',
'ownerAccountId': 'string',
'kmsKeyId': 'string'
}
},
'state': 'ENABLED'|'DISABLED',
'scheduleType': 'CUSTOMER_MANAGED'|'AWS_MANAGED',
'lastTriggeredTime': 123,
'lastExecutionStatus': 'Running'|'InvalidQuery'|'Complete'|'Failed'|'Timeout',
'scheduleStartTime': 123,
'scheduleEndTime': 123,
'executionRoleArn': 'string',
'creationTime': 123,
'lastUpdatedTime': 123
}
Response Structure
(dict) --
scheduledQueryArn (string) --
The ARN of the scheduled query.
name (string) --
The name of the scheduled query.
description (string) --
The description of the scheduled query.
queryLanguage (string) --
The query language used by the scheduled query.
queryString (string) --
The query string executed by the scheduled query.
logGroupIdentifiers (list) --
The log groups queried by the scheduled query.
(string) --
scheduleExpression (string) --
The cron expression that defines when the scheduled query runs.
timezone (string) --
The timezone used for evaluating the schedule expression.
startTimeOffset (integer) --
The time offset in seconds that defines the lookback period for the query.
endTimeOffset (integer) --
The time offset in seconds that defines the end of the lookback period for the query.
destinationConfiguration (dict) --
Configuration for where query results are delivered.
s3Configuration (dict) --
Configuration for delivering query results to Amazon S3.
destinationIdentifier (string) --
The Amazon S3 URI where query results are delivered. Must be a valid S3 URI format.
roleArn (string) --
The ARN of the IAM role that grants permissions to write query results to the specified Amazon S3 destination.
ownerAccountId (string) --
The Amazon Web Services accountId for the bucket owning account.
kmsKeyId (string) --
The Amazon Resource Name (ARN) of the KMS encryption key. Must belong to the same Amazon Web Services Region as the destination Amazon S3 bucket.
state (string) --
The current state of the scheduled query.
scheduleType (string) --
The schedule type of the scheduled query. Valid values are CUSTOMER_MANAGED and AWS_MANAGED.
lastTriggeredTime (integer) --
The timestamp when the scheduled query was last executed.
lastExecutionStatus (string) --
The status of the most recent execution of the scheduled query.
scheduleStartTime (integer) --
The start time for the scheduled query in Unix epoch format.
scheduleEndTime (integer) --
The end time for the scheduled query in Unix epoch format.
executionRoleArn (string) --
The ARN of the IAM role used to execute the query and deliver results.
creationTime (integer) --
The timestamp when the scheduled query was created.
lastUpdatedTime (integer) --
The timestamp when the scheduled query was last updated.
{'scheduleType': 'CUSTOMER_MANAGED | AWS_MANAGED'}
Response {'scheduledQueries': {'scheduleType': 'CUSTOMER_MANAGED | AWS_MANAGED'}}
Lists all scheduled queries in your account and region. You can filter results by state to show only enabled or disabled queries.
See also: AWS API Documentation
Request Syntax
client.list_scheduled_queries(
maxResults=123,
nextToken='string',
state='ENABLED'|'DISABLED',
scheduleType='CUSTOMER_MANAGED'|'AWS_MANAGED'
)
integer
The maximum number of scheduled queries to return. Valid range is 1 to 1000.
string
The token for the next set of items to return. The token expires after 24 hours.
string
Filter scheduled queries by state. Valid values are ENABLED and DISABLED. If not specified, all scheduled queries are returned.
string
Filter scheduled queries by schedule type. Valid values are CUSTOMER_MANAGED and AWS_MANAGED. If not specified, scheduled queries of all schedule types are returned.
dict
Response Syntax
{
'nextToken': 'string',
'scheduledQueries': [
{
'scheduledQueryArn': 'string',
'name': 'string',
'state': 'ENABLED'|'DISABLED',
'scheduleType': 'CUSTOMER_MANAGED'|'AWS_MANAGED',
'lastTriggeredTime': 123,
'lastExecutionStatus': 'Running'|'InvalidQuery'|'Complete'|'Failed'|'Timeout',
'scheduleExpression': 'string',
'timezone': 'string',
'destinationConfiguration': {
's3Configuration': {
'destinationIdentifier': 'string',
'roleArn': 'string',
'ownerAccountId': 'string',
'kmsKeyId': 'string'
}
},
'creationTime': 123,
'lastUpdatedTime': 123
},
]
}
Response Structure
(dict) --
nextToken (string) --
The token for the next set of items to return. The token expires after 24 hours.
scheduledQueries (list) --
An array of scheduled query summary information.
(dict) --
Summary information about a scheduled query, including basic configuration and execution status.
scheduledQueryArn (string) --
The ARN of the scheduled query.
name (string) --
The name of the scheduled query.
state (string) --
The current state of the scheduled query.
scheduleType (string) --
The schedule type of the scheduled query. Valid values are CUSTOMER_MANAGED and AWS_MANAGED.
lastTriggeredTime (integer) --
The timestamp when the scheduled query was last executed.
lastExecutionStatus (string) --
The status of the most recent execution.
scheduleExpression (string) --
The cron expression that defines when the scheduled query runs.
timezone (string) --
The timezone used for evaluating the schedule expression.
destinationConfiguration (dict) --
Configuration for where query results are delivered.
s3Configuration (dict) --
Configuration for delivering query results to Amazon S3.
destinationIdentifier (string) --
The Amazon S3 URI where query results are delivered. Must be a valid S3 URI format.
roleArn (string) --
The ARN of the IAM role that grants permissions to write query results to the specified Amazon S3 destination.
ownerAccountId (string) --
The Amazon Web Services accountId for the bucket owning account.
kmsKeyId (string) --
The Amazon Resource Name (ARN) of the KMS encryption key. Must belong to the same Amazon Web Services Region as the destination Amazon S3 bucket.
creationTime (integer) --
The timestamp when the scheduled query was created.
lastUpdatedTime (integer) --
The timestamp when the scheduled query was last updated.
{'endTimeOffset': 'long'}
Response {'endTimeOffset': 'long', 'scheduleType': 'CUSTOMER_MANAGED | AWS_MANAGED'}
Updates an existing scheduled query with new configuration. This operation uses PUT semantics, allowing modification of query parameters, schedule, and destinations.
See also: AWS API Documentation
Request Syntax
client.update_scheduled_query(
identifier='string',
description='string',
queryLanguage='CWLI'|'SQL'|'PPL',
queryString='string',
logGroupIdentifiers=[
'string',
],
scheduleExpression='string',
timezone='string',
startTimeOffset=123,
endTimeOffset=123,
destinationConfiguration={
's3Configuration': {
'destinationIdentifier': 'string',
'roleArn': 'string',
'ownerAccountId': 'string',
'kmsKeyId': 'string'
}
},
scheduleStartTime=123,
scheduleEndTime=123,
executionRoleArn='string',
state='ENABLED'|'DISABLED'
)
string
[REQUIRED]
The ARN or name of the scheduled query to update.
string
An updated description for the scheduled query.
string
[REQUIRED]
The updated query language for the scheduled query.
string
[REQUIRED]
The updated query string to execute.
list
The updated array of log group names or ARNs to query.
(string) --
string
[REQUIRED]
The updated cron expression that defines when the scheduled query runs.
string
The updated timezone for evaluating the schedule expression.
integer
The updated time offset in seconds that defines the lookback period for the query.
integer
The updated time offset in seconds that defines the end of the lookback period for the query.
dict
The updated configuration for where to deliver query results.
s3Configuration (dict) -- [REQUIRED]
Configuration for delivering query results to Amazon S3.
destinationIdentifier (string) -- [REQUIRED]
The Amazon S3 URI where query results are delivered. Must be a valid S3 URI format.
roleArn (string) -- [REQUIRED]
The ARN of the IAM role that grants permissions to write query results to the specified Amazon S3 destination.
ownerAccountId (string) --
The Amazon Web Services accountId for the bucket owning account.
kmsKeyId (string) --
The Amazon Resource Name (ARN) of the KMS encryption key. Must belong to the same Amazon Web Services Region as the destination Amazon S3 bucket.
integer
The updated start time for the scheduled query in Unix epoch format.
integer
The updated end time for the scheduled query in Unix epoch format.
string
[REQUIRED]
The updated ARN of the IAM role that grants permissions to execute the query and deliver results.
string
The updated state of the scheduled query.
dict
Response Syntax
{
'scheduledQueryArn': 'string',
'name': 'string',
'description': 'string',
'queryLanguage': 'CWLI'|'SQL'|'PPL',
'queryString': 'string',
'logGroupIdentifiers': [
'string',
],
'scheduleExpression': 'string',
'timezone': 'string',
'startTimeOffset': 123,
'endTimeOffset': 123,
'destinationConfiguration': {
's3Configuration': {
'destinationIdentifier': 'string',
'roleArn': 'string',
'ownerAccountId': 'string',
'kmsKeyId': 'string'
}
},
'state': 'ENABLED'|'DISABLED',
'scheduleType': 'CUSTOMER_MANAGED'|'AWS_MANAGED',
'lastTriggeredTime': 123,
'lastExecutionStatus': 'Running'|'InvalidQuery'|'Complete'|'Failed'|'Timeout',
'scheduleStartTime': 123,
'scheduleEndTime': 123,
'executionRoleArn': 'string',
'creationTime': 123,
'lastUpdatedTime': 123
}
Response Structure
(dict) --
scheduledQueryArn (string) --
The ARN of the updated scheduled query.
name (string) --
The name of the updated scheduled query.
description (string) --
The description of the updated scheduled query.
queryLanguage (string) --
The query language of the updated scheduled query.
queryString (string) --
The query string of the updated scheduled query.
logGroupIdentifiers (list) --
The log groups queried by the updated scheduled query.
(string) --
scheduleExpression (string) --
The cron expression of the updated scheduled query.
timezone (string) --
The timezone of the updated scheduled query.
startTimeOffset (integer) --
The time offset of the updated scheduled query.
endTimeOffset (integer) --
The end time offset in seconds of the updated scheduled query.
destinationConfiguration (dict) --
The destination configuration of the updated scheduled query.
s3Configuration (dict) --
Configuration for delivering query results to Amazon S3.
destinationIdentifier (string) --
The Amazon S3 URI where query results are delivered. Must be a valid S3 URI format.
roleArn (string) --
The ARN of the IAM role that grants permissions to write query results to the specified Amazon S3 destination.
ownerAccountId (string) --
The Amazon Web Services accountId for the bucket owning account.
kmsKeyId (string) --
The Amazon Resource Name (ARN) of the KMS encryption key. Must belong to the same Amazon Web Services Region as the destination Amazon S3 bucket.
state (string) --
The state of the updated scheduled query.
scheduleType (string) --
The schedule type of the updated scheduled query.
lastTriggeredTime (integer) --
The timestamp when the updated scheduled query was last executed.
lastExecutionStatus (string) --
The status of the most recent execution of the updated scheduled query.
scheduleStartTime (integer) --
The start time of the updated scheduled query.
scheduleEndTime (integer) --
The end time of the updated scheduled query.
executionRoleArn (string) --
The execution role ARN of the updated scheduled query.
creationTime (integer) --
The timestamp when the scheduled query was originally created.
lastUpdatedTime (integer) --
The timestamp when the scheduled query was last updated.