Amazon CloudWatch Logs

2016/08/02 - Amazon CloudWatch Logs - 2 updated api methods

DescribeMetricFilters (updated) Link ¶
Changes (response)
{'metricFilters': {'metricTransformations': {'defaultValue': 'double'}}}

Returns all the metrics 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 metric filters. If there are more metric filters to list, the response would contain a nextToken value in the response body. You can also limit the number of metric filters returned in the response by specifying the limit parameter in the request.

Request Syntax

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

string

param logGroupName

[REQUIRED]

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

type filterNamePrefix

string

param filterNamePrefix

Will only return metric 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 DescribeMetricFilters request.

type limit

integer

param limit

The maximum number of items returned in the response. If you don't specify a value, the request would return up to 50 items.

rtype

dict

returns

Response Syntax

{
    'metricFilters': [
        {
            'filterName': 'string',
            'filterPattern': 'string',
            'metricTransformations': [
                {
                    'metricName': 'string',
                    'metricNamespace': 'string',
                    'metricValue': 'string',
                    'defaultValue': 123.0
                },
            ],
            'creationTime': 123
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) --

    • metricFilters (list) --

      • (dict) --

        Metric filters can be used to express how CloudWatch Logs would extract metric observations from ingested log events and transform them to metric data in a CloudWatch metric.

        • filterName (string) --

          A name for a metric or subscription filter.

        • 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.

        • metricTransformations (list) --

          • (dict) --

            • metricName (string) --

              Name of the metric.

            • metricNamespace (string) --

              Namespace to which the metric belongs.

            • metricValue (string) --

              A string representing a value to publish to this metric when a filter pattern matches a log event.

            • defaultValue (float) --

              (Optional) A default value to emit when a filter pattern does not match a log event. Can be null.

        • 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.

PutMetricFilter (updated) Link ¶
Changes (request)
{'metricTransformations': {'defaultValue': 'double'}}

Creates or updates a metric filter and associates it with the specified log group. Metric filters allow you to configure rules to extract metric data from log events ingested through PutLogEvents requests.

The maximum number of metric filters that can be associated with a log group is 100.

Request Syntax

client.put_metric_filter(
    logGroupName='string',
    filterName='string',
    filterPattern='string',
    metricTransformations=[
        {
            'metricName': 'string',
            'metricNamespace': 'string',
            'metricValue': 'string',
            'defaultValue': 123.0
        },
    ]
)
type logGroupName

string

param logGroupName

[REQUIRED]

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

type filterName

string

param filterName

[REQUIRED]

A name for the metric filter.

type filterPattern

string

param filterPattern

[REQUIRED]

A valid CloudWatch Logs filter pattern for extracting metric data out of ingested log events.

type metricTransformations

list

param metricTransformations

[REQUIRED]

A collection of information needed to define how metric data gets emitted.

  • (dict) --

    • metricName (string) -- [REQUIRED]

      Name of the metric.

    • metricNamespace (string) -- [REQUIRED]

      Namespace to which the metric belongs.

    • metricValue (string) -- [REQUIRED]

      A string representing a value to publish to this metric when a filter pattern matches a log event.

    • defaultValue (float) --

      (Optional) A default value to emit when a filter pattern does not match a log event. Can be null.

returns

None