cloudstax / firecamp

Serverless Platform for the stateful services
https://www.cloudstax.io
Apache License 2.0
208 stars 21 forks source link

Automatically add CloudWatch Logs filters and alarms #75

Open jazzl0ver opened 5 years ago

jazzl0ver commented 5 years ago

Here is the feature request: when a service is being created, automatically add warnings and errors filters to the cloudwatch logs and setup alarms. This can be enabled by a special cli key, like -enable-service-alarms "mySNSTopic" (or expect an email address instead and create an SNS topic for that). The AWS CLI command lines might be:

aws logs put-metric-filter --log-group-name firecamp-qa-cass-qa-bd751a2269a44a2e52898bc0dd5cb2ac --filter-name "cass-qa" --filter-pattern "?WARN ?ERROR" --metric-transformations 'metricName=cass-qa,metricValue=1,metricNamespace="firecamp-qa LogMetrics"'

aws cloudwatch put-metric-alarm --alarm-name "cass-qa LogMetrics" --actions-enabled --alarm-actions "arn:aws:sns:us-east-1:00000000:mySNSTopic" --metric-name cass-qa --namespace "firecamp-qa LogMetrics" --period 300 --evaluation-periods 1 --datapoints-to-alarm 1 --threshold 0 --comparison-operator GreaterThanThreshold --treat-missing-data notBreaching --statistic Sum --output json

I believe this is very useful thing to have. What do you think?