CloudWatchLogs / Client / describe_query_definitions

describe_query_definitions#

CloudWatchLogs.Client.describe_query_definitions(**kwargs)#

This operation returns a paginated list of your saved CloudWatch Logs Insights query definitions. You can retrieve query definitions from the current account or from a source account that is linked to the current account.

You can use the queryDefinitionNamePrefix parameter to limit the results to only the query definitions that have names that start with a certain string.

See also: AWS API Documentation

Request Syntax

response = client.describe_query_definitions(
    queryLanguage='CWLI'|'SQL'|'PPL',
    queryDefinitionNamePrefix='string',
    maxResults=123,
    nextToken='string'
)
Parameters:
  • queryLanguage (string) – The query language used for this query. For more information about the query languages that CloudWatch Logs supports, see Supported query languages.

  • queryDefinitionNamePrefix (string) – Use this parameter to filter your results to only the query definitions that have names that start with the prefix you specify.

  • maxResults (integer) – Limits the number of returned query definitions to the specified number.

  • nextToken (string) – The token for the next set of items to return. The token expires after 24 hours.

Return type:

dict

Returns:

Response Syntax

{
    'queryDefinitions': [
        {
            'queryLanguage': 'CWLI'|'SQL'|'PPL',
            'queryDefinitionId': 'string',
            'name': 'string',
            'queryString': 'string',
            'lastModified': 123,
            'logGroupNames': [
                'string',
            ]
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) –

    • queryDefinitions (list) –

      The list of query definitions that match your request.

      • (dict) –

        This structure contains details about a saved CloudWatch Logs Insights query definition.

        • queryLanguage (string) –

          The query language used for this query. For more information about the query languages that CloudWatch Logs supports, see Supported query languages.

        • queryDefinitionId (string) –

          The unique ID of the query definition.

        • name (string) –

          The name of the query definition.

        • queryString (string) –

          The query string to use for this definition. For more information, see CloudWatch Logs Insights Query Syntax.

        • lastModified (integer) –

          The date that the query definition was most recently modified.

        • logGroupNames (list) –

          If this query definition contains a list of log groups that it is limited to, that list appears here.

          • (string) –

    • nextToken (string) –

      The token for the next set of items to return. The token expires after 24 hours.

Exceptions

  • CloudWatchLogs.Client.exceptions.InvalidParameterException

  • CloudWatchLogs.Client.exceptions.ServiceUnavailableException