Amazon CloudWatch Logs

2015/06/04 - Amazon CloudWatch Logs - 3 new api methods

PutSubscriptionFilter (new) Link ¶

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 requests and have them delivered to a specific destination. Currently the only supported destination is an Amazon Kinesis stream belonging to the same account as the subscription filter.

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

Request Syntax

client.put_subscription_filter(
    logGroupName='string',
    filterName='string',
    filterPattern='string',
    destinationArn='string',
    roleArn='string'
)
type logGroupName

string

param logGroupName

[REQUIRED]

The name of the log group to associate the subscription filter with.

type filterName

string

param filterName

[REQUIRED]

A name for the subscription filter.

type filterPattern

string

param filterPattern

[REQUIRED]

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

type destinationArn

string

param destinationArn

[REQUIRED]

The ARN of an Amazon Kinesis stream to deliver matching log events to.

type roleArn

string

param roleArn

[REQUIRED]

The ARN of an IAM role that grants Amazon CloudWatch Logs permissions to do Amazon Kinesis PutRecord requests on the desitnation stream.

returns

None

DescribeSubscriptionFilters (new) Link ¶

Returns all the subscription filters associated with the specified log group. The list returned in the response is ASCII-sorted by filter name.

By default, this operation returns up to 50 subscription filters. If there are more subscription filters to list, the response would contain a nextToken value in the response body. You can also limit the number of subscription filters returned in the response by specifying the limit parameter in the request.

Request Syntax

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

string

param logGroupName

[REQUIRED]

The log group name for which subscription filters are to be listed.

type filterNamePrefix

string

param filterNamePrefix

Will only return subscription filters that match the provided filterNamePrefix. If you don't specify a value, no prefix filter is applied.

type nextToken

string

param nextToken

A string token used for pagination that points to the next page of results. It must be a value obtained from the response of the previous request. The token expires after 24 hours.

type limit

integer

param limit

The maximum number of results to return.

rtype

dict

returns

Response Syntax

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

Response Structure

  • (dict) --

    • subscriptionFilters (list) --

      • (dict) --

        • filterName (string) --

          A name for a metric or subscription filter.

        • logGroupName (string) --

        • filterPattern (string) --

          A symbolic description of how Amazon 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) --

        • roleArn (string) --

        • creationTime (integer) --

          A point in time expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.

    • nextToken (string) --

      A string token used for pagination that points to the next page of results. It must be a value obtained from the response of the previous request. The token expires after 24 hours.

DeleteSubscriptionFilter (new) Link ¶

Deletes a subscription filter associated with the specified log group.

Request Syntax

client.delete_subscription_filter(
    logGroupName='string',
    filterName='string'
)
type logGroupName

string

param logGroupName

[REQUIRED]

The name of the log group that is associated with the subscription filter to delete.

type filterName

string

param filterName

[REQUIRED]

The name of the subscription filter to delete.

returns

None