MetricFilter

class aws_cdk.aws_logs.MetricFilter(scope, id, *, log_group, filter_pattern, metric_name, metric_namespace, default_value=None, metric_value=None)

Bases: aws_cdk.core.Resource

A filter that extracts information from CloudWatch Logs and emits to CloudWatch Metrics.

__init__(scope, id, *, log_group, filter_pattern, metric_name, metric_namespace, default_value=None, metric_value=None)
Parameters
  • scope (Construct) –

  • id (str) –

  • props

  • log_group (ILogGroup) – The log group to create the filter on.

  • filter_pattern (IFilterPattern) – Pattern to search for log events.

  • metric_name (str) – The name of the metric to emit.

  • metric_namespace (str) – The namespace of the metric to emit.

  • default_value (Union[int, float, None]) – The value to emit if the pattern does not match a particular event. Default: No metric emitted.

  • metric_value (Optional[str]) – The value to emit for the metric. Can either be a literal number (typically “1”), or the name of a field in the structure to take the value from the matched event. If you are using a field value, the field value must have been matched using the pattern. If you want to specify a field from a matched JSON structure, use ‘$.fieldName’, and make sure the field is in the pattern (if only as ‘$.fieldName = *’). If you want to specify a field from a matched space-delimited structure, use ‘$fieldName’. Default: “1”

Return type

None

Methods

to_string()

Returns a string representation of this construct.

Return type

str

Attributes

node

Construct tree node which offers APIs for interacting with the construct tree.

Return type

ConstructNode

stack

The stack in which this resource is defined.

Return type

Stack

Static Methods

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool