logs: SubscriptionFilter does not provide metric* helpers #8141
Labels
@aws-cdk/aws-logs
Related to Amazon CloudWatch Logs
effort/medium
Medium work item – several days of effort
feature-request
A feature should be added or improved.
p2
The AWS Logs SubscriptionFilter construct should provide
metric*
methods that CDK resources typically provide. See for example:Function#metrics*
methodsUse Case
All
SubscriptionFilter
metrics (e.g. seeForwardedLogEvents
,DeliveryErrors
,DeliveryThrottling
in the Monitoring AWS Logs with CloudWatch Metrics docs) requires some dimensions to be specified:LogGroupName
DestinationType
FilterName
The first two are easy to specify since the
LogGroupName
is also required while creating the construct andDestinationType
a service name (e.g.Lambda
). However, there appears to be no way to getFilterName
using CDK:FilterName
- so it can't be directly specified ( and is always dynamically generated).FilterName
is likeMyStackName-MyLogicalID29669D87-GCMA0Q4KKALH
(in CloudFormation): so it can't directly be specified using aFn.ref
(since the logicalId for CDK constructs is dynamic). Possibly related to: CDK Refactoring Tools aws-cdk-rfcs#162.Proposed Solution
metric*
methods on SubscriptionFilter construct.SubscriptionFilter
construct to get references to properties, such as the relatedlogGroup
(which is required as a constructor argument), like most CDK constructs.Other
For more details, see this StackOverflow question.
As shown in the SO post above, a possible workaround is to use the Stack#getLogicalId method.
This is a 🚀 Feature Request
The text was updated successfully, but these errors were encountered: