AWS Native is in preview. AWS Classic is fully supported.
aws-native.logs.MetricFilter
Explore with Pulumi AI
AWS Native is in preview. AWS Classic is fully supported.
The AWS::Logs::MetricFilter
resource specifies a metric filter that describes how CWL extracts information from logs and transforms it into Amazon CloudWatch metrics. If you have multiple metric filters that are associated with a log group, all the filters are applied to the log streams in that group.
The maximum number of metric filters that can be associated with a log group is 100.
Create MetricFilter Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new MetricFilter(name: string, args: MetricFilterArgs, opts?: CustomResourceOptions);
@overload
def MetricFilter(resource_name: str,
args: MetricFilterArgs,
opts: Optional[ResourceOptions] = None)
@overload
def MetricFilter(resource_name: str,
opts: Optional[ResourceOptions] = None,
filter_pattern: Optional[str] = None,
log_group_name: Optional[str] = None,
metric_transformations: Optional[Sequence[MetricFilterMetricTransformationArgs]] = None,
filter_name: Optional[str] = None)
func NewMetricFilter(ctx *Context, name string, args MetricFilterArgs, opts ...ResourceOption) (*MetricFilter, error)
public MetricFilter(string name, MetricFilterArgs args, CustomResourceOptions? opts = null)
public MetricFilter(String name, MetricFilterArgs args)
public MetricFilter(String name, MetricFilterArgs args, CustomResourceOptions options)
type: aws-native:logs:MetricFilter
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args MetricFilterArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args MetricFilterArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args MetricFilterArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args MetricFilterArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args MetricFilterArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
MetricFilter Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The MetricFilter resource accepts the following input properties:
- Filter
Pattern string - A filter pattern for extracting metric data out of ingested log events. For more information, see Filter and Pattern Syntax.
- Log
Group stringName - The name of an existing log group that you want to associate with this metric filter.
- Metric
Transformations List<Pulumi.Aws Native. Logs. Inputs. Metric Filter Metric Transformation> - The metric transformations.
- Filter
Name string - The name of the metric filter.
- Filter
Pattern string - A filter pattern for extracting metric data out of ingested log events. For more information, see Filter and Pattern Syntax.
- Log
Group stringName - The name of an existing log group that you want to associate with this metric filter.
- Metric
Transformations []MetricFilter Metric Transformation Args - The metric transformations.
- Filter
Name string - The name of the metric filter.
- filter
Pattern String - A filter pattern for extracting metric data out of ingested log events. For more information, see Filter and Pattern Syntax.
- log
Group StringName - The name of an existing log group that you want to associate with this metric filter.
- metric
Transformations List<MetricFilter Metric Transformation> - The metric transformations.
- filter
Name String - The name of the metric filter.
- filter
Pattern string - A filter pattern for extracting metric data out of ingested log events. For more information, see Filter and Pattern Syntax.
- log
Group stringName - The name of an existing log group that you want to associate with this metric filter.
- metric
Transformations MetricFilter Metric Transformation[] - The metric transformations.
- filter
Name string - The name of the metric filter.
- filter_
pattern str - A filter pattern for extracting metric data out of ingested log events. For more information, see Filter and Pattern Syntax.
- log_
group_ strname - The name of an existing log group that you want to associate with this metric filter.
- metric_
transformations Sequence[MetricFilter Metric Transformation Args] - The metric transformations.
- filter_
name str - The name of the metric filter.
- filter
Pattern String - A filter pattern for extracting metric data out of ingested log events. For more information, see Filter and Pattern Syntax.
- log
Group StringName - The name of an existing log group that you want to associate with this metric filter.
- metric
Transformations List<Property Map> - The metric transformations.
- filter
Name String - The name of the metric filter.
Outputs
All input properties are implicitly available as output properties. Additionally, the MetricFilter resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Supporting Types
MetricFilterDimension, MetricFilterDimensionArgs
- Key string
- The name for the CW metric dimension that the metric filter creates. Dimension names must contain only ASCII characters, must include at least one non-whitespace character, and cannot start with a colon (:).
- Value string
- The log event field that will contain the value for this dimension. This dimension will only be published for a metric if the value is found in the log event. For example,
$.eventType
for JSON log events, or$server
for space-delimited log events.
- Key string
- The name for the CW metric dimension that the metric filter creates. Dimension names must contain only ASCII characters, must include at least one non-whitespace character, and cannot start with a colon (:).
- Value string
- The log event field that will contain the value for this dimension. This dimension will only be published for a metric if the value is found in the log event. For example,
$.eventType
for JSON log events, or$server
for space-delimited log events.
- key String
- The name for the CW metric dimension that the metric filter creates. Dimension names must contain only ASCII characters, must include at least one non-whitespace character, and cannot start with a colon (:).
- value String
- The log event field that will contain the value for this dimension. This dimension will only be published for a metric if the value is found in the log event. For example,
$.eventType
for JSON log events, or$server
for space-delimited log events.
- key string
- The name for the CW metric dimension that the metric filter creates. Dimension names must contain only ASCII characters, must include at least one non-whitespace character, and cannot start with a colon (:).
- value string
- The log event field that will contain the value for this dimension. This dimension will only be published for a metric if the value is found in the log event. For example,
$.eventType
for JSON log events, or$server
for space-delimited log events.
- key str
- The name for the CW metric dimension that the metric filter creates. Dimension names must contain only ASCII characters, must include at least one non-whitespace character, and cannot start with a colon (:).
- value str
- The log event field that will contain the value for this dimension. This dimension will only be published for a metric if the value is found in the log event. For example,
$.eventType
for JSON log events, or$server
for space-delimited log events.
- key String
- The name for the CW metric dimension that the metric filter creates. Dimension names must contain only ASCII characters, must include at least one non-whitespace character, and cannot start with a colon (:).
- value String
- The log event field that will contain the value for this dimension. This dimension will only be published for a metric if the value is found in the log event. For example,
$.eventType
for JSON log events, or$server
for space-delimited log events.
MetricFilterMetricTransformation, MetricFilterMetricTransformationArgs
- Metric
Name string - The name of the CloudWatch metric.
- Metric
Namespace string - A custom namespace to contain your metric in CloudWatch. Use namespaces to group together metrics that are similar. For more information, see Namespaces.
- Metric
Value string - The value that is published to the CloudWatch metric. For example, if you're counting the occurrences of a particular term like
Error
, specify 1 for the metric value. If you're counting the number of bytes transferred, reference the value that is in the log event by using $. followed by the name of the field that you specified in the filter pattern, such as$.size
. - Default
Value double - (Optional) The value to emit when a filter pattern does not match a log event. This value can be null.
- Dimensions
List<Pulumi.
Aws Native. Logs. Inputs. Metric Filter Dimension> - The fields to use as dimensions for the metric. One metric filter can include as many as three dimensions.
Metrics extracted from log events are charged as custom metrics. To prevent unexpected high charges, do not specify high-cardinality fields such as
IPAddress
orrequestID
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 Charges. - Unit
Pulumi.
Aws Native. Logs. Metric Filter Metric Transformation Unit - The unit to assign to the metric. If you omit this, the unit is set as
None
.
- Metric
Name string - The name of the CloudWatch metric.
- Metric
Namespace string - A custom namespace to contain your metric in CloudWatch. Use namespaces to group together metrics that are similar. For more information, see Namespaces.
- Metric
Value string - The value that is published to the CloudWatch metric. For example, if you're counting the occurrences of a particular term like
Error
, specify 1 for the metric value. If you're counting the number of bytes transferred, reference the value that is in the log event by using $. followed by the name of the field that you specified in the filter pattern, such as$.size
. - Default
Value float64 - (Optional) The value to emit when a filter pattern does not match a log event. This value can be null.
- Dimensions
[]Metric
Filter Dimension - The fields to use as dimensions for the metric. One metric filter can include as many as three dimensions.
Metrics extracted from log events are charged as custom metrics. To prevent unexpected high charges, do not specify high-cardinality fields such as
IPAddress
orrequestID
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 Charges. - Unit
Metric
Filter Metric Transformation Unit - The unit to assign to the metric. If you omit this, the unit is set as
None
.
- metric
Name String - The name of the CloudWatch metric.
- metric
Namespace String - A custom namespace to contain your metric in CloudWatch. Use namespaces to group together metrics that are similar. For more information, see Namespaces.
- metric
Value String - The value that is published to the CloudWatch metric. For example, if you're counting the occurrences of a particular term like
Error
, specify 1 for the metric value. If you're counting the number of bytes transferred, reference the value that is in the log event by using $. followed by the name of the field that you specified in the filter pattern, such as$.size
. - default
Value Double - (Optional) The value to emit when a filter pattern does not match a log event. This value can be null.
- dimensions
List<Metric
Filter Dimension> - The fields to use as dimensions for the metric. One metric filter can include as many as three dimensions.
Metrics extracted from log events are charged as custom metrics. To prevent unexpected high charges, do not specify high-cardinality fields such as
IPAddress
orrequestID
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 Charges. - unit
Metric
Filter Metric Transformation Unit - The unit to assign to the metric. If you omit this, the unit is set as
None
.
- metric
Name string - The name of the CloudWatch metric.
- metric
Namespace string - A custom namespace to contain your metric in CloudWatch. Use namespaces to group together metrics that are similar. For more information, see Namespaces.
- metric
Value string - The value that is published to the CloudWatch metric. For example, if you're counting the occurrences of a particular term like
Error
, specify 1 for the metric value. If you're counting the number of bytes transferred, reference the value that is in the log event by using $. followed by the name of the field that you specified in the filter pattern, such as$.size
. - default
Value number - (Optional) The value to emit when a filter pattern does not match a log event. This value can be null.
- dimensions
Metric
Filter Dimension[] - The fields to use as dimensions for the metric. One metric filter can include as many as three dimensions.
Metrics extracted from log events are charged as custom metrics. To prevent unexpected high charges, do not specify high-cardinality fields such as
IPAddress
orrequestID
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 Charges. - unit
Metric
Filter Metric Transformation Unit - The unit to assign to the metric. If you omit this, the unit is set as
None
.
- metric_
name str - The name of the CloudWatch metric.
- metric_
namespace str - A custom namespace to contain your metric in CloudWatch. Use namespaces to group together metrics that are similar. For more information, see Namespaces.
- metric_
value str - The value that is published to the CloudWatch metric. For example, if you're counting the occurrences of a particular term like
Error
, specify 1 for the metric value. If you're counting the number of bytes transferred, reference the value that is in the log event by using $. followed by the name of the field that you specified in the filter pattern, such as$.size
. - default_
value float - (Optional) The value to emit when a filter pattern does not match a log event. This value can be null.
- dimensions
Sequence[Metric
Filter Dimension] - The fields to use as dimensions for the metric. One metric filter can include as many as three dimensions.
Metrics extracted from log events are charged as custom metrics. To prevent unexpected high charges, do not specify high-cardinality fields such as
IPAddress
orrequestID
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 Charges. - unit
Metric
Filter Metric Transformation Unit - The unit to assign to the metric. If you omit this, the unit is set as
None
.
- metric
Name String - The name of the CloudWatch metric.
- metric
Namespace String - A custom namespace to contain your metric in CloudWatch. Use namespaces to group together metrics that are similar. For more information, see Namespaces.
- metric
Value String - The value that is published to the CloudWatch metric. For example, if you're counting the occurrences of a particular term like
Error
, specify 1 for the metric value. If you're counting the number of bytes transferred, reference the value that is in the log event by using $. followed by the name of the field that you specified in the filter pattern, such as$.size
. - default
Value Number - (Optional) The value to emit when a filter pattern does not match a log event. This value can be null.
- dimensions List<Property Map>
- The fields to use as dimensions for the metric. One metric filter can include as many as three dimensions.
Metrics extracted from log events are charged as custom metrics. To prevent unexpected high charges, do not specify high-cardinality fields such as
IPAddress
orrequestID
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 Charges. - 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"
- The unit to assign to the metric. If you omit this, the unit is set as
None
.
MetricFilterMetricTransformationUnit, MetricFilterMetricTransformationUnitArgs
- Seconds
- Seconds
- Microseconds
- Microseconds
- Milliseconds
- Milliseconds
- Bytes
- Bytes
- Kilobytes
- Kilobytes
- Megabytes
- Megabytes
- Gigabytes
- Gigabytes
- Terabytes
- Terabytes
- Bits
- Bits
- Kilobits
- Kilobits
- Megabits
- Megabits
- Gigabits
- Gigabits
- Terabits
- Terabits
- Percent
- Percent
- Count
- Count
- Bytes
Second - Bytes/Second
- Kilobytes
Second - Kilobytes/Second
- Megabytes
Second - Megabytes/Second
- Gigabytes
Second - Gigabytes/Second
- Terabytes
Second - Terabytes/Second
- Bits
Second - Bits/Second
- Kilobits
Second - Kilobits/Second
- Megabits
Second - Megabits/Second
- Gigabits
Second - Gigabits/Second
- Terabits
Second - Terabits/Second
- Count
Second - Count/Second
- None
- None
- Metric
Filter Metric Transformation Unit Seconds - Seconds
- Metric
Filter Metric Transformation Unit Microseconds - Microseconds
- Metric
Filter Metric Transformation Unit Milliseconds - Milliseconds
- Metric
Filter Metric Transformation Unit Bytes - Bytes
- Metric
Filter Metric Transformation Unit Kilobytes - Kilobytes
- Metric
Filter Metric Transformation Unit Megabytes - Megabytes
- Metric
Filter Metric Transformation Unit Gigabytes - Gigabytes
- Metric
Filter Metric Transformation Unit Terabytes - Terabytes
- Metric
Filter Metric Transformation Unit Bits - Bits
- Metric
Filter Metric Transformation Unit Kilobits - Kilobits
- Metric
Filter Metric Transformation Unit Megabits - Megabits
- Metric
Filter Metric Transformation Unit Gigabits - Gigabits
- Metric
Filter Metric Transformation Unit Terabits - Terabits
- Metric
Filter Metric Transformation Unit Percent - Percent
- Metric
Filter Metric Transformation Unit Count - Count
- Metric
Filter Metric Transformation Unit Bytes Second - Bytes/Second
- Metric
Filter Metric Transformation Unit Kilobytes Second - Kilobytes/Second
- Metric
Filter Metric Transformation Unit Megabytes Second - Megabytes/Second
- Metric
Filter Metric Transformation Unit Gigabytes Second - Gigabytes/Second
- Metric
Filter Metric Transformation Unit Terabytes Second - Terabytes/Second
- Metric
Filter Metric Transformation Unit Bits Second - Bits/Second
- Metric
Filter Metric Transformation Unit Kilobits Second - Kilobits/Second
- Metric
Filter Metric Transformation Unit Megabits Second - Megabits/Second
- Metric
Filter Metric Transformation Unit Gigabits Second - Gigabits/Second
- Metric
Filter Metric Transformation Unit Terabits Second - Terabits/Second
- Metric
Filter Metric Transformation Unit Count Second - Count/Second
- Metric
Filter Metric Transformation Unit None - None
- Seconds
- Seconds
- Microseconds
- Microseconds
- Milliseconds
- Milliseconds
- Bytes
- Bytes
- Kilobytes
- Kilobytes
- Megabytes
- Megabytes
- Gigabytes
- Gigabytes
- Terabytes
- Terabytes
- Bits
- Bits
- Kilobits
- Kilobits
- Megabits
- Megabits
- Gigabits
- Gigabits
- Terabits
- Terabits
- Percent
- Percent
- Count
- Count
- Bytes
Second - Bytes/Second
- Kilobytes
Second - Kilobytes/Second
- Megabytes
Second - Megabytes/Second
- Gigabytes
Second - Gigabytes/Second
- Terabytes
Second - Terabytes/Second
- Bits
Second - Bits/Second
- Kilobits
Second - Kilobits/Second
- Megabits
Second - Megabits/Second
- Gigabits
Second - Gigabits/Second
- Terabits
Second - Terabits/Second
- Count
Second - Count/Second
- None
- None
- Seconds
- Seconds
- Microseconds
- Microseconds
- Milliseconds
- Milliseconds
- Bytes
- Bytes
- Kilobytes
- Kilobytes
- Megabytes
- Megabytes
- Gigabytes
- Gigabytes
- Terabytes
- Terabytes
- Bits
- Bits
- Kilobits
- Kilobits
- Megabits
- Megabits
- Gigabits
- Gigabits
- Terabits
- Terabits
- Percent
- Percent
- Count
- Count
- Bytes
Second - Bytes/Second
- Kilobytes
Second - Kilobytes/Second
- Megabytes
Second - Megabytes/Second
- Gigabytes
Second - Gigabytes/Second
- Terabytes
Second - Terabytes/Second
- Bits
Second - Bits/Second
- Kilobits
Second - Kilobits/Second
- Megabits
Second - Megabits/Second
- Gigabits
Second - Gigabits/Second
- Terabits
Second - Terabits/Second
- Count
Second - Count/Second
- None
- None
- SECONDS
- Seconds
- MICROSECONDS
- Microseconds
- MILLISECONDS
- Milliseconds
- BYTES
- Bytes
- KILOBYTES
- Kilobytes
- MEGABYTES
- Megabytes
- GIGABYTES
- Gigabytes
- TERABYTES
- Terabytes
- BITS
- Bits
- KILOBITS
- Kilobits
- MEGABITS
- Megabits
- GIGABITS
- Gigabits
- TERABITS
- Terabits
- PERCENT
- Percent
- COUNT
- Count
- BYTES_SECOND
- Bytes/Second
- KILOBYTES_SECOND
- Kilobytes/Second
- MEGABYTES_SECOND
- Megabytes/Second
- GIGABYTES_SECOND
- Gigabytes/Second
- TERABYTES_SECOND
- Terabytes/Second
- BITS_SECOND
- Bits/Second
- KILOBITS_SECOND
- Kilobits/Second
- MEGABITS_SECOND
- Megabits/Second
- GIGABITS_SECOND
- Gigabits/Second
- TERABITS_SECOND
- Terabits/Second
- COUNT_SECOND
- Count/Second
- NONE
- None
- "Seconds"
- Seconds
- "Microseconds"
- Microseconds
- "Milliseconds"
- Milliseconds
- "Bytes"
- Bytes
- "Kilobytes"
- Kilobytes
- "Megabytes"
- Megabytes
- "Gigabytes"
- Gigabytes
- "Terabytes"
- Terabytes
- "Bits"
- Bits
- "Kilobits"
- Kilobits
- "Megabits"
- Megabits
- "Gigabits"
- Gigabits
- "Terabits"
- Terabits
- "Percent"
- Percent
- "Count"
- Count
- "Bytes/Second"
- Bytes/Second
- "Kilobytes/Second"
- Kilobytes/Second
- "Megabytes/Second"
- Megabytes/Second
- "Gigabytes/Second"
- Gigabytes/Second
- "Terabytes/Second"
- Terabytes/Second
- "Bits/Second"
- Bits/Second
- "Kilobits/Second"
- Kilobits/Second
- "Megabits/Second"
- Megabits/Second
- "Gigabits/Second"
- Gigabits/Second
- "Terabits/Second"
- Terabits/Second
- "Count/Second"
- Count/Second
- "None"
- None
Package Details
- Repository
- AWS Native pulumi/pulumi-aws-native
- License
- Apache-2.0
AWS Native is in preview. AWS Classic is fully supported.