Skip to main content

queries

Creates, updates, deletes, gets or lists a queries resource.

Overview

Namequeries
TypeResource
Idaws.logs.queries

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
bytes_scannednumber (double)The total number of bytes scanned by the query. This indicates the cost associated with the query.
create_timeinteger (int64)The date and time that this query was created.
log_group_namestringThe name of the log group scanned by this query. (pattern: <code>[.-_/#A-Za-z0-9]+</code>)
query_durationinteger (int64)The duration in milliseconds that the query took to execute.
query_idstringThe unique ID number of this query.
query_languagestringThe query language used for this query. For more information about the query languages that CloudWatch Logs supports, see Supported query languages. (CWLI, SQL, PPL)
query_stringstringThe query string used in this query.
statusstringThe status of this query. Possible values are Cancelled, Complete, Failed, Running, Scheduled, and Unknown. (Scheduled, Running, Complete, Failed, Cancelled, Timeout, Unknown)
user_identitystringThe ARN of the user who ran the query.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
describe_queriesselectregionReturns a list of CloudWatch Logs Insights queries that are scheduled, running, or have been run recently in this account. You can request all queries or limit it to queries of a specific log group or queries with a certain status. This operation includes both interactive queries started directly by users and automated queries executed by scheduled query configurations. Scheduled query executions appear in the results alongside manually initiated queries, providing visibility into all query activity in your account.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples

Returns a list of CloudWatch Logs Insights queries that are scheduled, running, or have been run recently in this account. You can request all queries or limit it to queries of a specific log group or queries with a certain status. This operation includes both interactive queries started directly by users and automated queries executed by scheduled query configurations. Scheduled query executions appear in the results alongside manually initiated queries, providing visibility into all query activity in your account.

SELECT
bytes_scanned,
create_time,
log_group_name,
query_duration,
query_id,
query_language,
query_string,
status,
user_identity
FROM aws.logs.queries
WHERE region = '{{ region }}' -- required
;