

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 筛选你的 DevOps Guru 通知
<a name="update-notifications-filter"></a>

您可以通过[更新 Amazon SNS 通知配置](update-notifications.md#update-notification-configurations)或使用 Amazon SNS 订阅筛选策略来筛选您的 DevOps Guru 通知。

**Topics**
+ [使用 Amazon SNS 订阅筛选策略来筛选通知](#use-subscription-filter-policy)
+ [Amazon Guru 筛选过的 Amazon SNS 通知示例 DevOps](#sample-filtered-notification)

## 使用 Amazon SNS 订阅筛选策略来筛选通知
<a name="use-subscription-filter-policy"></a>

您可以创建亚马逊简单通知服务 (Amazon SNS) Simple Notification 订阅筛选政策，以减少从亚马逊 Guru 收到的通知数量。 DevOps

使用筛选策略来指定您接收的通知类型。您可以使用以下关键字来筛选 Amazon SNS 消息。
+ `NEW_INSIGHT` — 在创建新见解时接收通知。
+ `CLOSED_INSIGHT` — 在现有见解关闭时接收通知。
+ `NEW_RECOMMENDATION` — 在根据见解创建新建议时接收通知。
+ `NEW_ASSOCIATION` — 在从见解中检测到新异常时接收通知。
+ `CLOSED_ASSOCIATION` — 在现有异常关闭时接收通知。
+ `SEVERITY_UPGRADED` — 在见解的严重性升级时接收通知

有关如何创建亚马逊 SNS 订阅筛选策略的信息，请参阅 *Amazon Simple Notification Service 开发人员指南*中的[亚马逊 SNS 订阅筛选策略](https://docs.aws.amazon.com/sns/latest/dg/sns-subscription-filter-policies.html)。在筛选策略中，您可以指定一个带有该策略 `MessageType` 的关键字。例如，以下内容将出现在筛选条件中，该筛选条件指定 Amazon SNS 主题仅在从见解中检测到新异常时才发送通知。

```
{ 
  "MessageType":["NEW_ ASSOCIATION"] 
}
```

## Amazon Guru 筛选过的 Amazon SNS 通知示例 DevOps
<a name="sample-filtered-notification"></a>

以下是一个来自具有筛选策略的 Amazon SNS 主题的 Amazon Simple Notiﬁcation Service (Amazon SNS) 通知的示例。它的 `MessageType` 被设置为 `NEW_ASSOCIATION`，因此只有在从见解中检测到新的异常时，它才会发送通知。

```
{
      "accountId": "123456789012",
      "region": "us-east-1",
      "messageType": "NEW_ASSOCIATION",
      "insightId": "ADyf4FvaVNDzu9MA2-IgFDkAAAAAAAAAEGpJd5sjicgauU2wmAlnWUyyI2hiO5it",
      "insightName": "Repeated Insight: Anomalous increase in Lambda ApigwLambdaDdbStack-22-Function duration due to increased number of invocations",
      "insightUrl": "https://us-east-1.console.aws.amazon.com/devops-guru/insight/reactive/ADyf4FvaVNDzu9MA2-IgFDkAAAAAAAAAEGpJd5sjicgauU2wmAlnWUyyI2hiO5it",
      "insightType": "REACTIVE",
      "insightDescription": "At March 29, 2023 22:02 GMT, Lambda function ApigwLambdaDdbStack-22-Function had\n an increased duration anomaly possibly caused by the Lambda function invocation increase. DevOps Guru has detected this is a repeated insight. DevOps Guru treats repeated insights as 'Low Severity'.",
      "startTime": 1628767500000,
      "startTimeISO": "2023-03-29T22:00:00Z",
      "anomalies": [
        {
          "id": "AG2n8ljW74BoI1CHu-m_oAgAAAF7Ohu24N4Yro69ZSdUtn_alzPH7VTpaL30JXiF",
          "startTime": 1628767500000,
          "startTimeISO": "2023-03-29T22:00:00Z",
          "openTime": 1680127740000,
          "openTimeISO": "2023-03-29T22:09:00Z",
          "sourceDetails": [
            {
              "dataSource": "CW_METRICS",
              "dataIdentifiers": {
                "namespace": "AWS/SQS",
                "name": "ApproximateAgeOfOldestMessage",
                "stat": "Maximum",
                "unit": "None",
                "period": "60",
                "dimensions": "{\"QueueName\":\"FindingNotificationsDLQ\"}"
              }
            }
          ],
          "associatedResourceArns":[
          	"arn:aws:sns:us-east-1:123456789012:DevOpsGuru-insights-sns"
          ]
        }
      ],
      "resourceCollection":{
      "cloudFormation":{
         "stackNames":[
            "CapstoneNotificationPublisherEcsApplicationInfrastructure"
          ]
        }
      }
}
```