Skip to content

AWS::Logs::MetricFilter - Dimension support #108

@brentcetinich

Description

@brentcetinich

I should be able to hard code a dimension (or use Fn::Sub) to specify a Dimension value, 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 $)

Currently if you try do do this you get:

        metricName: `MemoryUsed`,
        metricValue: "$some_value",
         dimensions: {
           FunctionName: `${node.ref}`
         },

Resource handler returned message "invalid request provided: AWS::Logs::MetricFilter. Invalid metric transformation: dimension values must be valid selector.

So instead I need to inject the lambda name into the metric name - This makes looking for the metric and reporting on it a miserable experience, but to get it to works I have to do this :

        metricName: `MemoryUsed-${node.ref}`,
        metricValue: "$some_value",


See https://aws.amazon.com/about-aws/whats-new/2021/05/amazon-cloudwatch-logs-announces-dimension-support-for-metric-filters/

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions