• 使用を開始する
  • 関連ドキュメント

Opsgenie を Amazon CloudTrail-Amazon CloudWatch と統合する

Opsgenie が CloudTrail と CloudWatch の各ユーザーに提供するもの

Amazon CloudWatch インテグレーションは、CloudWatch アラームに従ってイベントをフィルタリングするための Amazon CloudTrail の使用率を向上させます。したがって、すべてのトレイル イベントを処理する代わりに、より精密なアラートが作成されます。

統合の機能性

When Amazon CloudTrail receives a new log, the log event is sent to Amazon CloudWatch Logs. CloudWatch monitors and evaluates trail events to filter important ones. When a CloudWatch alarm is triggered, an alert is created in Opsgenie automatically through the integration. To set up CloudWatch alarms, Amazon CloudFormation template is used.

CloudTrail イベント用に Amazon CloudWatch インテグレーションを Opsgenie に追加する

  1. Go to Settings > Integrations. Search for Amazon CloudTrail and select Add. (You don't have to configure SNS and CloudWatch alarms that are shown in this page, CloudFormation template will be used for configurations in this document.)

  2. Specify who is notified of Amazon CloudTrail alerts using the Responders field. Auto-complete suggestions are provided as you type.

  3. [Save Integration (統合の保存)] を選択します。

Amazon CloudTrail での設定

1. "Amazon CloudTrail コンソール" から [トレイル] に移動します。[Create trail (トレイルを作成)] をクリックするか、既存のトレイルを使用します。

Amazon CloudTrail トレイルの作成

2. [S3] タブで、新しい S3 バケットを作成するか、既存の S3 バケットを選択します。次に、トレイルを作成します。「SNS トピック」が CloudFormation テンプレートで設定されます。

Amazon CloudTrail S3 バケット

3. [CloudWatch ログ] では [設定] をクリックします。

Amazon CloudWatch ログ

4. [新規または既存のログ グループ] では、ログ グループ名を入力して [続行] をクリックします。

Amazon CloudWatch ログ

5. For the IAM role, choose an existing role or create one. Click Allow to grant CloudTrail permissions to create a CloudWatch Logs log stream and deliver events.

6. CloudFormation テンプレートをダウンロードする: https://raw.githubusercontent.com/opsgenie/opsgenie-integration/master/cloudtrail/CloudWatch_Alarms_for_CloudTrail_API_Activity_OpsGenie.json
SNS のトピックとサブスクリプション、CloudWatch アラームは、CloudFormation テンプレートの JSON ファイルにあります。

7. AWS CloudFormation コンソールを開いて、[スタックの作成] をクリックします。

AWS CloudFormation

8. [テンプレートを選択] ページで、[ファイルを選択] をクリックして以前にダウンロードした AWS CloudFormation テンプレートを選択します。次に、[次へ] をクリックします。

CloudFormation テンプレートの選択

9. For Name, type a stack name. CloudWatchAlarmsForCloudTrailOpsgenie is used for the following example. "Endpoint" is the same with the integration endpoint created at the beginning of this document. For "LogGroupName", type the name of the log group specified when configuring the trail to deliver log files to CloudWatch Logs at 4. step. Click Next.

CloudFormation 詳細を指定する

10. [オプション] では、タグを作成するかその他の詳細オプションを設定します。これらは必須ではありません。[次へ]、[作成] の順にクリックします。

11. CloudFormation スタックが作成されたことを確認します。

CloudFormation スタック

12. CloudWatch ページに移動して、アラートが表示されていることを確認します。

CloudWatch アラーム

13. [SNS] ページに移動して、トピックが作成されてサブスクリプションが追加されていることを確認します。

CloudWatch トピック

The CloudFormation template that is used in this document contains some basic CloudWatch alarms to filter CloudTrail events such as Amazon S3 Bucket EventsNetwork EventsAmazon EC2 Events and CloudTrail and IAM Events. For further usage, modify the CloudFormation template.

Amazon CloudWatch を介した Opsgenie Amazon CloudTrail インテグレーションからのペイロードの例

JSON

{ "Type": "Notification", "MessageId": "x59595a1-5f0b-5ea8-8ad8-c714d42a48d1", "TopicArn": "arn:aws:sns:us-east-1:485823035610:CloudWatchAlarmsForCloudTrail-AlarmNotificationTopic-1OGWTWXTZ9W5X", "Subject": "ALARM: \"CloudTrailChanges\" in US East (N. Virginia)", "Message": "{\"AlarmName\":\"CloudTrailChanges\",\"AlarmDescription\":\"Alarms when an API call is made to create, update or delete a CloudTrail trail, or to start or stop logging to a trail.\",\"AWSAccountId\":\"825426534673\",\"NewStateValue\":\"ALARM\",\"NewStateReason\":\"Threshold Crossed: 1 datapoint [1.0 (03/07/18 14:18:00)] was greater than or equal to the threshold (1.0).\",\"StateChangeTime\":\"2018-07-03T14:23:28.949+0000\",\"Region\":\"US East (N. Virginia)\",\"OldStateValue\":\"INSUFFICIENT_DATA\",\"Trigger\":{\"MetricName\":\"CloudTrailEventCount\",\"Namespace\":\"CloudTrailMetrics\",\"StatisticType\":\"Statistic\",\"Statistic\":\"SUM\",\"Unit\":null,\"Dimensions\":[],\"Period\":300,\"EvaluationPeriods\":1,\"ComparisonOperator\":\"GreaterThanOrEqualToThreshold\",\"Threshold\":1.0,\"TreatMissingData\":\"\",\"EvaluateLowSampleCountPercentile\":\"\"}}", "Timestamp": "2018-07-03T14:23:29.029Z", "SignatureVersion": "1", "Signature": "uzbpxna6ywOS1OSVhP24PDjXd/DCIPoU+D5jPI9U6BORcWIbnofUcyRqF5L/ssJ89kjuEgVxQjwxfLrrTReG38bx05g4WrNIPWfwxiWYV9G5GLW89h4lr3X/NgvXqvbx3QiA9UeeOgLcStXb19RXuX5Y3ckLHpbChKurWoxA+eBx19ce4ZO0w6jr66ZEEPoDOtWZ4Pplx5a4YdGKnWJA8Ostarx1dOziLIxSSzl6BFVEeUM8Fr07T34iIZx7IDn5Ln76muISG6BG2CeUcEExyXgizfHde/h/O2qqH2truxUnZ15Ez7/I9mHXDtikyBS4dL8B5dXWlIignuK12rk9rg==", "SigningCertURL": "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-eaea6120er6ea12e88dcd8bcb5dca752.pem", "UnsubscribeURL": "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:585416034660:CloudWatchAlarmsForCloudTrail-AlarmNotificationTopic-1OGWxWXTZ9W5B:c88cde98-cd5f-4f36-857c-8c92339c55d2" }

このペイロードは Opsgenie によって次のように解析されます。

JSON

{ "AWSAccountId": "935426074681", "TopicArn": "arn:aws:sns:us-east-1:785926035630:CloudWatchAlarmsForCloudTrail-AlarmNotificationTopic-1OGWTWXTZ9W5B", "alertSource": "com.opsgenie.client.model.dto.ActionSourceCustomDto@35ae8359[domain=integration,sourceType=CloudWatch,sourceName=CloudWatch,incomingDataId=a2fde995-bd11-47d7-a5fa-bce4f94f5328,sourceSubName=Create Alert,customSourceName=<null>,actorUserId=<null>]", "NewStateReason": "Threshold Crossed: 1 datapoint [1.0 (03/07/18 14:18:00)] was greater than or equal to the threshold (1.0).", "NewStateValue": "ALARM", "Subject": "ALARM: \"CloudTrailChanges\" in US East (N. Virginia)", "StateChangeTime": "2018-07-03T14:23:28.949+0000", "Type": "Notification", "Trigger": "MetricName : CloudTrailEventCount\nNamespace : CloudTrailMetrics\nStatisticType : Statistic\nStatistic : SUM\nUnit : null\nDimensions : []\nPeriod : 300\nEvaluationPeriods : 1\nComparisonOperator : GreaterThanOrEqualToThreshold\nThreshold : 1.0\nTreatMissingData : \nEvaluateLowSampleCountPercentile :", "AlarmDescription": "Alarms when an API call is made to create, update or delete a CloudTrail trail, or to start or stop logging to a trail.", "AlarmName": "CloudTrailChanges", "OldStateValue": "INSUFFICIENT_DATA", "delayIfDoesNotExists": "true", "Region": "US East (N. Virginia)" }



さらにヘルプが必要ですか?

アトラシアン コミュニティをご利用ください。