Amazon CloudWatch Logs

2020/05/07 - Amazon CloudWatch Logs - 3 new api methods

Changes  Amazon CloudWatch Logs now offers the ability to interact with Logs Insights queries via the new PutQueryDefinition, DescribeQueryDefinitions, and DeleteQueryDefinition APIs.

DeleteQueryDefinition (new) Link ¶

See also: AWS API Documentation

Request Syntax

client.delete_query_definition(
    queryDefinitionId='string'
)
type queryDefinitionId

string

param queryDefinitionId

[REQUIRED]

rtype

dict

returns

Response Syntax

{
    'success': True|False
}

Response Structure

  • (dict) --

    • success (boolean) --

PutQueryDefinition (new) Link ¶

See also: AWS API Documentation

Request Syntax

client.put_query_definition(
    name='string',
    queryDefinitionId='string',
    logGroupNames=[
        'string',
    ],
    queryString='string'
)
type name

string

param name

[REQUIRED]

type queryDefinitionId

string

param queryDefinitionId

type logGroupNames

list

param logGroupNames
  • (string) --

type queryString

string

param queryString

[REQUIRED]

rtype

dict

returns

Response Syntax

{
    'queryDefinitionId': 'string'
}

Response Structure

  • (dict) --

    • queryDefinitionId (string) --

DescribeQueryDefinitions (new) Link ¶

See also: AWS API Documentation

Request Syntax

client.describe_query_definitions(
    queryDefinitionNamePrefix='string',
    maxResults=123,
    nextToken='string'
)
type queryDefinitionNamePrefix

string

param queryDefinitionNamePrefix

type maxResults

integer

param maxResults

type nextToken

string

param nextToken

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

rtype

dict

returns

Response Syntax

{
    'queryDefinitions': [
        {
            'queryDefinitionId': 'string',
            'name': 'string',
            'queryString': 'string',
            'lastModified': 123,
            'logGroupNames': [
                'string',
            ]
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • queryDefinitions (list) --

      • (dict) --

        • queryDefinitionId (string) --

        • name (string) --

        • queryString (string) --

        • lastModified (integer) --

        • logGroupNames (list) --

          • (string) --

    • nextToken (string) --

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