CloudWatchLogs / Client / describe_metric_filters

describe_metric_filters#

CloudWatchLogs.Client.describe_metric_filters(**kwargs)#

Lists the specified metric filters. You can list all of the metric filters or filter the results by log name, prefix, metric name, or metric namespace. The results are ASCII-sorted by filter name.

See also: AWS API Documentation

Request Syntax

response = client.describe_metric_filters(
    logGroupName='string',
    filterNamePrefix='string',
    nextToken='string',
    limit=123,
    metricName='string',
    metricNamespace='string'
)
Parameters:
  • logGroupName (string) – The name of the log group.

  • filterNamePrefix (string) – The prefix to match. CloudWatch Logs uses the value that you set here only if you also include the logGroupName parameter in your request.

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

  • limit (integer) – The maximum number of items returned. If you don’t specify a value, the default is up to 50 items.

  • metricName (string) – Filters results to include only those with the specified metric name. If you include this parameter in your request, you must also include the metricNamespace parameter.

  • metricNamespace (string) – Filters results to include only those in the specified namespace. If you include this parameter in your request, you must also include the metricName parameter.

Return type:

dict

Returns:

Response Syntax

{
    'metricFilters': [
        {
            'filterName': 'string',
            'filterPattern': 'string',
            'metricTransformations': [
                {
                    'metricName': 'string',
                    'metricNamespace': 'string',
                    'metricValue': 'string',
                    'defaultValue': 123.0,
                    'dimensions': {
                        'string': 'string'
                    },
                    'unit': 'Seconds'|'Microseconds'|'Milliseconds'|'Bytes'|'Kilobytes'|'Megabytes'|'Gigabytes'|'Terabytes'|'Bits'|'Kilobits'|'Megabits'|'Gigabits'|'Terabits'|'Percent'|'Count'|'Bytes/Second'|'Kilobytes/Second'|'Megabytes/Second'|'Gigabytes/Second'|'Terabytes/Second'|'Bits/Second'|'Kilobits/Second'|'Megabits/Second'|'Gigabits/Second'|'Terabits/Second'|'Count/Second'|'None'
                },
            ],
            'creationTime': 123,
            'logGroupName': 'string',
            'applyOnTransformedLogs': True|False
        },
    ],
    'nextToken': 'string'
}

Response Structure

  • (dict) –

    • metricFilters (list) –

      The metric filters.

      • (dict) –

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

        • filterName (string) –

          The name of the metric filter.

        • filterPattern (string) –

          A symbolic description of how CloudWatch Logs should interpret the data in each log event. For example, a log event can 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) –

          The metric transformations.

          • (dict) –

            Indicates how to transform ingested log events to metric data in a CloudWatch metric.

            • metricName (string) –

              The name of the CloudWatch metric.

            • metricNamespace (string) –

              A custom namespace to contain your metric in CloudWatch. Use namespaces to group together metrics that are similar. For more information, see Namespaces.

            • metricValue (string) –

              The value to publish to the CloudWatch metric when a filter pattern matches a log event.

            • defaultValue (float) –

              (Optional) The value to emit when a filter pattern does not match a log event. This value can be null.

            • dimensions (dict) –

              The fields to use as dimensions for the metric. One metric filter can include as many as three dimensions.

              Warning

              Metrics extracted from log events are charged as custom metrics. To prevent unexpected high charges, do not specify high-cardinality fields such as IPAddress or requestID as dimensions. Each different value found for a dimension is treated as a separate metric and accrues charges as a separate custom metric.

              CloudWatch Logs disables a metric filter if it generates 1000 different name/value pairs for your specified dimensions within a certain amount of time. This helps to prevent accidental high charges.

              You can also set up a billing alarm to alert you if your charges are higher than expected. For more information, see Creating a Billing Alarm to Monitor Your Estimated Amazon Web Services Charges.

              • (string) –

                • (string) –

            • unit (string) –

              The unit to assign to the metric. If you omit this, the unit is set as None.

        • creationTime (integer) –

          The creation time of the metric filter, expressed as the number of milliseconds after Jan 1, 1970 00:00:00 UTC.

        • logGroupName (string) –

          The name of the log group.

        • applyOnTransformedLogs (boolean) –

          This parameter is valid only for log groups that have an active log transformer. For more information about log transformers, see PutTransformer.

          If this value is true, the metric filter is applied on the transformed version of the log events instead of the original ingested log events.

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

  • CloudWatchLogs.Client.exceptions.ServiceUnavailableException