CloudTrail / Client / list_queries
list_queries¶
- CloudTrail.Client.list_queries(**kwargs)¶
Warning
CloudTrail Lake will no longer be open to new customers starting May 31, 2026. If you would like to use CloudTrail Lake, sign up prior to that date. Existing customers can continue to use the service as normal. For more information, see CloudTrail Lake availability change.
Returns a list of queries and query statuses for the past seven days. You must specify an ARN value for
EventDataStore. Optionally, to shorten the list of results, you can specify a time range, formatted as timestamps, by addingStartTimeandEndTimeparameters, and aQueryStatusvalue. Valid values forQueryStatusincludeQUEUED,RUNNING,FINISHED,FAILED,TIMED_OUT, orCANCELLED.See also: AWS API Documentation
Request Syntax
response = client.list_queries( EventDataStore='string', NextToken='string', MaxResults=123, StartTime=datetime(2015, 1, 1), EndTime=datetime(2015, 1, 1), QueryStatus='QUEUED'|'RUNNING'|'FINISHED'|'FAILED'|'CANCELLED'|'TIMED_OUT' )
- Parameters:
EventDataStore (string) –
[REQUIRED]
The ARN (or the ID suffix of the ARN) of an event data store on which queries were run.
NextToken (string) – A token you can use to get the next page of results.
MaxResults (integer) – The maximum number of queries to show on a page.
StartTime (datetime) – Use with
EndTimeto bound aListQueriesrequest, and limit its results to only those queries run within a specified time period.EndTime (datetime) – Use with
StartTimeto bound aListQueriesrequest, and limit its results to only those queries run within a specified time period.QueryStatus (string) – The status of queries that you want to return in results. Valid values for
QueryStatusincludeQUEUED,RUNNING,FINISHED,FAILED,TIMED_OUT, orCANCELLED.
- Return type:
dict
- Returns:
Response Syntax
{ 'Queries': [ { 'QueryId': 'string', 'QueryStatus': 'QUEUED'|'RUNNING'|'FINISHED'|'FAILED'|'CANCELLED'|'TIMED_OUT', 'CreationTime': datetime(2015, 1, 1) }, ], 'NextToken': 'string' }
Response Structure
(dict) –
Queries (list) –
Lists matching query results, and shows query ID, status, and creation time of each query.
(dict) –
A SQL string of criteria about events that you want to collect in an event data store.
QueryId (string) –
The ID of a query.
QueryStatus (string) –
The status of the query. This can be
QUEUED,RUNNING,FINISHED,FAILED,TIMED_OUT, orCANCELLED.CreationTime (datetime) –
The creation time of a query.
NextToken (string) –
A token you can use to get the next page of results.
Exceptions
CloudTrail.Client.exceptions.EventDataStoreARNInvalidExceptionCloudTrail.Client.exceptions.EventDataStoreNotFoundExceptionCloudTrail.Client.exceptions.InactiveEventDataStoreExceptionCloudTrail.Client.exceptions.InvalidDateRangeExceptionCloudTrail.Client.exceptions.InvalidMaxResultsExceptionCloudTrail.Client.exceptions.InvalidNextTokenExceptionCloudTrail.Client.exceptions.InvalidParameterExceptionCloudTrail.Client.exceptions.InvalidQueryStatusExceptionCloudTrail.Client.exceptions.OperationNotPermittedExceptionCloudTrail.Client.exceptions.UnsupportedOperationExceptionCloudTrail.Client.exceptions.NoManagementAccountSLRExistsException