1 year ago

#336480

test-img

dulongj

Linking to AWS Cloudwatch Logs from Alarm SNS

I have CloudWatch alarms sending SNS messages back with error information, and I'm using that along with the slackWebhook to send alarm messages to our Slack channel. I'd like to be able to include a link to the relevant logs, but right now all I'm seeing that may be useful is the alarm Arn. Can I use this somehow, or is there a way to scrape the aws error logs for that Arn and link to that somehow?

Here's the JSON from the SNS message:

{
  "AlarmName": "EmailErrorsFF58B22B-HFUJGANB6BDD",
  "AlarmDescription": "Some Description",
  "AWSAccountId": "<REMOVED>",
  "AlarmConfigurationUpdatedTimestamp": "2022-03-24T12:20:22.195+0000",
  "NewStateValue": "ALARM",
  "NewStateReason": "Threshold Crossed: 1 datapoint [1.0 (25/03/22 15:39:00)] was greater than the threshold (0.0).",
  "StateChangeTime": "2022-03-25T15:44:45.495+0000",
  "Region": "US East (N. Virginia)",
  "AlarmArn": "arn:aws:cloudwatch:<REMOVED>",
  "OldStateValue": "OK",
  "OKActions": [],
  "AlarmActions": [
    "arn:aws:sns:<REMOVED>"
  ],
  "InsufficientDataActions": [],
  "Trigger": {
    "MetricName": "Errors",
    "Namespace": "AWS/Lambda",
    "StatisticType": "Statistic",
    "Statistic": "SUM",
    "Unit": null,
    "Dimensions": [
      {
        "value": "Email-production",
        "name": "FunctionName"
      }
    ],
    "Period": 300,
    "EvaluationPeriods": 1,
    "ComparisonOperator": "GreaterThanThreshold",
    "Threshold": 0,
    "TreatMissingData": "",
    "EvaluateLowSampleCountPercentile": ""
  }
}

amazon-web-services

aws-lambda

amazon-cloudwatch

amazon-cloudwatchlogs

0 Answers

Your Answer

Accepted video resources