Metric Filter configuration producing unexpected results
This is a Bug Report
Description
I am trying to configure a metric filter alarm with a given filter pattern for the function under my service,
custom:
alerts:
topics:
alarm:
topic: arn:aws:sns:eu-west-1:704255512929:CloudWatch-ErrorLogs
function:
- name: AnAlarm
metric: AnError
treatMissingData: notBreaching
threshold: 0
statistic: Sum
period: 60
evaluationPeriods: 1
comparisonOperator: GreaterThanThreshold
pattern: '[ERROR]'
I was expecting this to create a single metric filter (ERROR) linked a single alarm that is then linked to an SNS Topic (CloudWatch-ErrorLogs), however what is actually happening is 2 metric filters are being created, one with a suffix ALERT and another with a suffix OK. Both of these are then linked to the same metric and the same alert.
From reviewing the code it appears there is code specific to create 2 metric filters, one for the Alert and one for the OK and I wondered why this was the case? Would it be possible to support a way of configuring it to exclude the OK metric filters?
Additional Data
- Serverless Framework Version: 1.26.0:
Yes, I also have the same concern.
Also, how can I define the metric value parameter?
I'm having the same issue. I'm trying to extract some values from a log, and the "OK" metric filter is polluting my metric data ... is there any feedback on this?
It would seem like the right thing to do to NOT create the "OK" metric filter, or at a minimum have a mechanism to allow the user to optionally not create it in the cloudformation stack...
I've created a fork of this project that allows you to capture custom metrics successfully, here is a link:
https://github.com/chinatti/serverless-plugin-aws-alerts#collecting-custom-metrics
@chinatti Brilliant! Any chance of fixing #54 whilst your at it?
@chinatti great addition, would it be worth a pull request?
I should do that - I've just been lazy (and I've never made a pull request before so I have to figure out how to do that :-). Let me see if I can get that together in the next week or so...
Any news?
Do we know when the following will be added into the release. Currently we are creating so many OK Metrics that we wont even use for and this code helps us saving the time and resources for OK Metric filters. https://github.com/chinatti/serverless-plugin-aws-alerts#collecting-custom-metrics
It still seems to be problem. Have we done the fix?
Any news? Still getting the same issue
with this forked version "useExternalStack = true" sadly does not work