We recommend new projects start with resources from the AWS provider.
aws-native.logs.getMetricFilter
Explore with Pulumi AI
We recommend new projects start with resources from the AWS provider.
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.
Using getMetricFilter
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getMetricFilter(args: GetMetricFilterArgs, opts?: InvokeOptions): Promise<GetMetricFilterResult>
function getMetricFilterOutput(args: GetMetricFilterOutputArgs, opts?: InvokeOptions): Output<GetMetricFilterResult>
def get_metric_filter(filter_name: Optional[str] = None,
log_group_name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetMetricFilterResult
def get_metric_filter_output(filter_name: Optional[pulumi.Input[str]] = None,
log_group_name: Optional[pulumi.Input[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetMetricFilterResult]
func LookupMetricFilter(ctx *Context, args *LookupMetricFilterArgs, opts ...InvokeOption) (*LookupMetricFilterResult, error)
func LookupMetricFilterOutput(ctx *Context, args *LookupMetricFilterOutputArgs, opts ...InvokeOption) LookupMetricFilterResultOutput
> Note: This function is named LookupMetricFilter
in the Go SDK.
public static class GetMetricFilter
{
public static Task<GetMetricFilterResult> InvokeAsync(GetMetricFilterArgs args, InvokeOptions? opts = null)
public static Output<GetMetricFilterResult> Invoke(GetMetricFilterInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetMetricFilterResult> getMetricFilter(GetMetricFilterArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
function: aws-native:logs:getMetricFilter
arguments:
# arguments dictionary
The following arguments are supported:
- Filter
Name string - The name of the metric filter.
- Log
Group stringName - The name of an existing log group that you want to associate with this metric filter.
- Filter
Name string - The name of the metric filter.
- Log
Group stringName - The name of an existing log group that you want to associate with this metric filter.
- filter
Name String - The name of the metric filter.
- log
Group StringName - The name of an existing log group that you want to associate with this metric filter.
- filter
Name string - The name of the metric filter.
- log
Group stringName - The name of an existing log group that you want to associate with this metric filter.
- filter_
name str - The name of the metric filter.
- log_
group_ strname - The name of an existing log group that you want to associate with this metric filter.
- filter
Name String - The name of the metric filter.
- log
Group StringName - The name of an existing log group that you want to associate with this metric filter.
getMetricFilter Result
The following output properties are available:
- Filter
Pattern string - A filter pattern for extracting metric data out of ingested log events. For more information, see Filter and Pattern Syntax.
- Metric
Transformations List<Pulumi.Aws Native. Logs. Outputs. Metric Filter Metric Transformation> - The metric transformations.
- Filter
Pattern string - A filter pattern for extracting metric data out of ingested log events. For more information, see Filter and Pattern Syntax.
- Metric
Transformations []MetricFilter Metric Transformation - The metric transformations.
- filter
Pattern String - A filter pattern for extracting metric data out of ingested log events. For more information, see Filter and Pattern Syntax.
- metric
Transformations List<MetricFilter Metric Transformation> - The metric transformations.
- filter
Pattern string - A filter pattern for extracting metric data out of ingested log events. For more information, see Filter and Pattern Syntax.
- metric
Transformations MetricFilter Metric Transformation[] - The metric transformations.
- filter_
pattern str - A filter pattern for extracting metric data out of ingested log events. For more information, see Filter and Pattern Syntax.
- metric_
transformations Sequence[MetricFilter Metric Transformation] - The metric transformations.
- filter
Pattern String - A filter pattern for extracting metric data out of ingested log events. For more information, see Filter and Pattern Syntax.
- metric
Transformations List<Property Map> - The metric transformations.
Supporting Types
MetricFilterDimension
- 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
- 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
Package Details
- Repository
- AWS Native pulumi/pulumi-aws-native
- License
- Apache-2.0
We recommend new projects start with resources from the AWS provider.