Amazon CloudWatch Logs

2016/12/14 - Amazon CloudWatch Logs - 3 new 3 updated api methods

TagLogGroup (new) Link ¶

Adds or updates the specified tags for the specified log group.

To list the tags for a log group, use ListTagsLogGroup. To remove tags, use UntagLogGroup.

For more information about tags, see Tag Log Groups in Amazon CloudWatch Logs in the Amazon CloudWatch Logs User Guide .

See also: AWS API Documentation

Request Syntax

client.tag_log_group(
    logGroupName='string',
    tags={
        'string': 'string'
    }
)
type logGroupName

string

param logGroupName

[REQUIRED]

The name of the log group.

type tags

dict

param tags

[REQUIRED]

The key-value pairs to use for the tags.

  • (string) --

    • (string) --

returns

None

UntagLogGroup (new) Link ¶

Removes the specified tags from the specified log group.

To list the tags for a log group, use ListTagsLogGroup. To add tags, use UntagLogGroup.

See also: AWS API Documentation

Request Syntax

client.untag_log_group(
    logGroupName='string',
    tags=[
        'string',
    ]
)
type logGroupName

string

param logGroupName

[REQUIRED]

The name of the log group.

type tags

list

param tags

[REQUIRED]

The tag keys. The corresponding tags are removed from the log group.

  • (string) --

returns

None

ListTagsLogGroup (new) Link ¶

Lists the tags for the specified log group.

To add tags, use TagLogGroup. To remove tags, use UntagLogGroup.

See also: AWS API Documentation

Request Syntax

client.list_tags_log_group(
    logGroupName='string'
)
type logGroupName

string

param logGroupName

[REQUIRED]

The name of the log group.

rtype

dict

returns

Response Syntax

{
    'tags': {
        'string': 'string'
    }
}

Response Structure

  • (dict) --

    • tags (dict) --

      The tags.

      • (string) --

        • (string) --

CreateLogGroup (updated) Link ¶
Changes (request)
{'tags': {'string': 'string'}}

Creates a log group with the specified name.

You can create up to 5000 log groups per account.

You must use the following guidelines when naming a log group:

  • Log group names must be unique within a region for an AWS account.

  • Log group names can be between 1 and 512 characters long.

  • Log group names consist of the following characters: a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), '/' (forward slash), and '.' (period).

See also: AWS API Documentation

Request Syntax

client.create_log_group(
    logGroupName='string',
    tags={
        'string': 'string'
    }
)
type logGroupName

string

param logGroupName

[REQUIRED]

The name of the log group.

type tags

dict

param tags

The key-value pairs to use for the tags.

  • (string) --

    • (string) --

returns

None

DescribeSubscriptionFilters (updated) Link ¶
Changes (response)
{'subscriptionFilters': {'distribution': 'Random | ByLogStream'}}

Lists the subscription filters for the specified log group. You can list all the subscription filters or filter the results by prefix. The results are ASCII-sorted by filter name.

See also: AWS API Documentation

Request Syntax

client.describe_subscription_filters(
    logGroupName='string',
    filterNamePrefix='string',
    nextToken='string',
    limit=123
)
type logGroupName

string

param logGroupName

[REQUIRED]

The name of the log group.

type filterNamePrefix

string

param filterNamePrefix

The prefix to match. If you don't specify a value, no prefix filter is applied.

type nextToken

string

param nextToken

The token for the next set of items to return. (You received this token from a previous call.)

type limit

integer

param limit

The maximum number of items returned. If you don't specify a value, the default is up to 50 items.

rtype

dict

returns

Response Syntax

{
    'subscriptionFilters': [
        {
            'filterName': 'string',
            'logGroupName': 'string',
            'filterPattern': 'string',
            'destinationArn': 'string',
            'roleArn': 'string',
            'distribution': 'Random'|'ByLogStream',
            'creationTime': 123
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • subscriptionFilters (list) --

      The subscription filters.

      • (dict) --

        Represents a subscription filter.

        • filterName (string) --

          The name of the subscription filter.

        • logGroupName (string) --

          The name of the log group.

        • filterPattern (string) --

          A symbolic description of how CloudWatch Logs should interpret the data in each log event. For example, a log event may contain timestamps, IP addresses, strings, and so on. You use the filter pattern to specify what to look for in the log event message.

        • destinationArn (string) --

          The Amazon Resource Name (ARN) of the destination.

        • roleArn (string) --

        • distribution (string) --

          The method used to distribute log data to the destination, when the destination is an Amazon Kinesis stream.

        • creationTime (integer) --

          The creation time of the subscription filter.

    • nextToken (string) --

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

PutSubscriptionFilter (updated) Link ¶
Changes (request)
{'distribution': 'Random | ByLogStream'}

Creates or updates a subscription filter and associates it with the specified log group. Subscription filters allow you to subscribe to a real-time stream of log events ingested through PutLogEvents and have them delivered to a specific destination. Currently, the supported destinations are:

  • An Amazon Kinesis stream belonging to the same account as the subscription filter, for same-account delivery.

  • A logical destination that belongs to a different account, for cross-account delivery.

  • An Amazon Kinesis Firehose stream that belongs to the same account as the subscription filter, for same-account delivery.

  • An AWS Lambda function that belongs to the same account as the subscription filter, for same-account delivery.

There can only be one subscription filter associated with a log group.

See also: AWS API Documentation

Request Syntax

client.put_subscription_filter(
    logGroupName='string',
    filterName='string',
    filterPattern='string',
    destinationArn='string',
    roleArn='string',
    distribution='Random'|'ByLogStream'
)
type logGroupName

string

param logGroupName

[REQUIRED]

The name of the log group.

type filterName

string

param filterName

[REQUIRED]

A name for the subscription filter.

type filterPattern

string

param filterPattern

[REQUIRED]

A filter pattern for subscribing to a filtered stream of log events.

type destinationArn

string

param destinationArn

[REQUIRED]

The ARN of the destination to deliver matching log events to. Currently, the supported destinations are:

  • An Amazon Kinesis stream belonging to the same account as the subscription filter, for same-account delivery.

  • A logical destination (specified using an ARN) belonging to a different account, for cross-account delivery.

  • An Amazon Kinesis Firehose stream belonging to the same account as the subscription filter, for same-account delivery.

  • An AWS Lambda function belonging to the same account as the subscription filter, for same-account delivery.

type roleArn

string

param roleArn

The ARN of an IAM role that grants CloudWatch Logs permissions to deliver ingested log events to the destination stream. You don't need to provide the ARN when you are working with a logical destination for cross-account delivery.

type distribution

string

param distribution

The method used to distribute log data to the destination, when the destination is an Amazon Kinesis stream. By default, log data is grouped by log stream. For a more even distribution, you can group log data randomly.

returns

None