cloudformation-coverage-roadmap icon indicating copy to clipboard operation
cloudformation-coverage-roadmap copied to clipboard

AWS::Logs::MetricFilter - Dimension support

Open crater9893 opened this issue 6 years ago • 15 comments

AWS::Logs::MetricFilter::-Dimension(s) support

2. Scope of request

Support for new attribute Dimension AWS::Logs::MetricFilter does not support Dimension list object Boto also does not support this and a case was raised (5852229791) https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/logs.html#CloudWatchLogs.Client.put_metric_filter

3. Expected behavior

It should be possible to specify a List of Dimension object that can contain values extracted from the log group metric filter

For example if I use Log::Metric filter to record as a metric my lambda memory usage. I should be able to extract the name of the lambda and also add the name of my Metric as a Dimension so that I can have better reporting. Currently the metric name looks like this I would rather have it so that the filter creates metrics named like this With dimension of the lambda name or any other additional Dimension value I want to extract from the log

4. Suggest specific test cases

5. Helpful Links to speed up research and evaluation

Boto also does not support this and a case was raised (5852229791) https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/logs.html#CloudWatchLogs.Client.put_metric_filter Same issue in reddit https://www.reddit.com/r/aws/comments/6dxbnz/cloudwatch_logs_metric_filter_with_dimension/

6. Category

Management

crater9893 avatar Mar 22 '20 09:03 crater9893

The API currently does not support this (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutMetricFilter.html), so it's currently impossible for CloudFormation (or boto3) to add this property

benbridts avatar Mar 23 '20 10:03 benbridts

The API currently does not support this (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutMetricFilter.html), so it's currently impossible for CloudFormation (or boto3) to add this property

It notes this in the original request

crater9893 avatar Apr 21 '20 03:04 crater9893

I'd love this functionality as well, but perhaps we need to open this with the CloudWatch team?

Simple use case: Create a Metric Filter for 404 response codes on an Apache httpd web server log. I'd like to be able to query/analyze/group the resulting metrics by an {instanceid} dimension, which is in the log stream name that is sending the log events into the CloudWatch Logs group.

wes-novack avatar May 22 '21 17:05 wes-novack

I saw that metric filters do now support dimensions (https://aws.amazon.com/about-aws/whats-new/2021/05/amazon-cloudwatch-logs-announces-dimension-support-for-metric-filters/).

I'm trying to get some setup, but the metric filters in question are managed via CloudFormation. Looking at https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-logs-metricfilter-metrictransformation.html I don't see any reference to dimensions.

Does CloudFormation already support metric filter dimensions, and if so, what is the syntax? If it doesn't, is there an ETA for when it will be added?

dhpiggott avatar Jun 03 '21 13:06 dhpiggott

We also ran into this issue with lack of dimensions support in CFn for AWS::Logs::MetricFilter, though it is supported in both UI and SDK.

srinivas-vangari avatar Jul 21 '21 18:07 srinivas-vangari

Would love to have this too :) It will reduce a lot the number of custom metrics/namespaces if we could use dimensions in cloudformation...

Please consider this in the roadmap

VRevol avatar Aug 17 '21 13:08 VRevol

Another vote for this.

Use case:

In the console on AWS API Gateway Access logs, I can use the extract dimensions feature to extract the status, resourcePath and httpMethod values to create metrics per status code with only one log metric filter

But

In CFN I have to create a metric filter per endpoint as no dimension extraction support :-(

jwalls89 avatar Aug 18 '21 14:08 jwalls89

There is a hard limit(100) to the number of metric filters you can create per log group. So, having the dimension support is really important.

as5908 avatar Oct 18 '21 23:10 as5908

The API currently does not support this (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_PutMetricFilter.html), so it's currently impossible for CloudFormation (or boto3) to add this property

Already supported. Please consider implementing the support of it too!

sugdyzhekov avatar Oct 24 '21 19:10 sugdyzhekov

Hi - just want to check in and see if there is any indication of when this will be implemented?

Thanks

nicc777 avatar Dec 28 '21 12:12 nicc777

@nicc777 it seems like it is being worked on right now:

https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-logs/issues/64#issuecomment-1027039571

simonwiesmann8732 avatar Feb 02 '22 12:02 simonwiesmann8732

I'd love this functionality as well, but perhaps we need to open this with the CloudWatch team?

Simple use case: Create a Metric Filter for 404 response codes on an Apache httpd web server log. I'd like to be able to query/analyze/group the resulting metrics by an {instanceid} dimension, which is in the log stream name that is sending the log events into the CloudWatch Logs group.

We are still unable to obtain the log stream name when using the metric filter right?

Rajagopal2000 avatar Feb 14 '23 06:02 Rajagopal2000

This is now implemented, per https://github.com/aws-cloudformation/aws-cloudformation-resource-providers-logs/issues/64#issuecomment-1282769773

tdmalone avatar Apr 26 '23 22:04 tdmalone

I should be able to hard code a dimension, rather than always pull it from a log line.

Use cases:

  • Filtering lambda logs that don't contain the function name.
  • Attributing logs to deployment environments (prod, qa, etc)

This could be easily achieved by allowing non-selectors as dimension values (strings that don't start with $)

alancnet avatar Sep 11 '23 20:09 alancnet

this is now implemented! @alancnet i suggest opening a new issue as an enhancement so that the service team can track this work more accurately.

TheDanBlanco avatar Sep 25 '23 23:09 TheDanBlanco