Amazon Simple Workflow Service
开发人员指南 (API 版本 2012-01-25)
AWS 文档中描述的 AWS 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 Amazon AWS 入门

使用 AWS CloudTrail 记录 Amazon Simple Workflow Service API 调用

Amazon SWF 与 AWS CloudTrail 集成,后者是一种服务,它捕获 Amazon SWF 或代表 Amazon SWF 发出的 API 调用,并将日志文件提交到您指定的 Amazon S3 存储桶。这些 API 调用可通过使用 Amazon SWF 控制台间接发出,也可以通过使用 Amazon SWF API 直接发出。通过使用 CloudTrail 收集的信息,您可以确定对 Amazon SWF 发出了什么请求、发出请求的源 IP 地址、何人发出的请求以及发出请求的时间等。要了解有关 CloudTrail 的更多信息,包括如何对其进行配置和启用,请参阅 AWS CloudTrail User Guide

CloudTrail 中的 Amazon SWF 信息

当 CloudTrail 日志记录启用时,将在日志文件中跟踪对 Amazon SWF 操作的调用。Amazon SWF 记录与其他 AWS 服务记录一起写入日志文件中。CloudTrail 根据指定的时间段和文件大小,来确定何时创建新文件并向其写入内容。

支持以下操作:

每个日志条目都包含有关生成请求的人员的信息。日志中的用户身份信息有助于确定请求是由根或 IAM 用户证书发出,通过某个角色或联合用户的临时安全证书发出,还是由其他 AWS 服务发出。有关更多信息,请参阅 CloudTrail 事件参考 中的 userIdentity 元素。

日志文件可以在存储桶中存储任意长时间,不过您也可以定义 Amazon S3 生命周期规则以自动存档或删除日志文件。默认情况下,您的日志文件使用 Amazon S3 服务器端加密进行加密。

如果需要针对日志文件传输快速采取措施,可选择让 CloudTrail 在传输新日志文件时发布 Amazon SNS 通知。有关更多信息,请参阅配置 Amazon SNS 通知

您也可以将多个 AWS 区域和多个 AWS 账户的日志文件聚合到单个 Amazon S3 存储桶中。有关更多信息,请参阅将 CloudTrail 日志文件聚合到单个 Amazon S3 存储桶中

Amazon SWF 日志文件条目示例

CloudTrail 日志文件可包含一个或多个日志条目,每个条目由多个 JSON 格式的事件组成。一个日志条目表示来自任何源的一个请求,包括有关所请求的操作、所有参数以及操作的日期和时间等信息。日志条目不一定具有任何特定顺序。也即,它们不是公用 API 调用的有序堆栈跟踪。

DeprecateActivityType

下面是 DeprecateActivityType 的 CloudTrail 日志的示例:

{ "eventVersion": "1.01", "eventID": "0f65b038-58ff-4d26-b1c7-eedff8db994b", "eventTime": "2014-05-07T22:45:36Z", "requestParameters": { "domain": "swf-example-domain", "activityType": { "version": "1.0", "name": "swf-example-activityType" } }, "responseElements": null, "awsRegion": "us-east-1", "eventName": "DeprecateActivityType", "userIdentity": { "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "type": "Root", "arn": "arn:aws:iam::244806523816:root", "principalId": "244806523816", "accountId": "244806523816" }, "eventSource": "swf.amazonaws.com", "requestID": "4e1a8e94-d639-11e3-9a1c-4dbc5d9f1a49", "userAgent": "aws-sdk-java/unknown-version Linux/2.6.18-164.el5 Java_HotSpot(TM)_64-Bit_Server_VM/24.45-b08", "sourceIPAddress": "10.61.88.189" }

DeprecateDomain

下面是 DeprecateDomain 的 CloudTrail 日志的示例:

{ "eventVersion": "1.01", "eventID": "a2be5766-3d3a-4bd3-8b88-4f3582cb52bc", "eventTime": "2014-05-07T22:46:00Z", "requestParameters": { "name": "swf-example-domain" }, "responseElements": null, "awsRegion": "us-east-1", "eventName": "DeprecateDomain", "userIdentity": { "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "type": "Root", "arn": "arn:aws:iam::244806523816:root", "principalId": "244806523816", "accountId": "244806523816" }, "eventSource": "swf.amazonaws.com", "requestID": "5c95ae06-d639-11e3-8836-a37995ed01ed", "userAgent": "aws-sdk-java/unknown-version Linux/2.6.18-164.el5 Java_HotSpot(TM)_64-Bit_Server_VM/24.45-b08", "sourceIPAddress": "10.61.88.189" }

DeprecateWorkflowType

下面是 DeprecateWorkflowType 的 CloudTrail 日志的示例:

{ "eventVersion": "1.01", "eventID": "ff6f4e8e-2401-4c1a-956a-f36dab55b22b", "eventTime": "2014-05-07T22:45:36Z", "requestParameters": { "domain": "swf-example-domain", "workflowType": { "version": "1.0", "name": "swf-example-workflowType" } }, "responseElements": null, "awsRegion": "us-east-1", "eventName": "DeprecateWorkflowType", "userIdentity": { "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "type": "Root", "arn": "arn:aws:iam::244806523816:root", "principalId": "244806523816", "accountId": "244806523816" }, "eventSource": "swf.amazonaws.com", "requestID": "4df29420-d639-11e3-8836-a37995ed01ed", "userAgent": "aws-sdk-java/unknown-version Linux/2.6.18-164.el5 Java_HotSpot(TM)_64-Bit_Server_VM/24.45-b08", "sourceIPAddress": "10.61.88.189" }

RegisterActivityType

下面是 RegisterActivityType 的 CloudTrail 日志的示例:

{ "eventVersion": "1.01", "eventID": "d4a99e9e-a980-4e7a-9d84-7b00806ab70f", "eventTime": "2014-05-07T22:03:38Z", "requestParameters": { "domain": "swf-example-domain", "defaultTaskScheduleToStartTimeout": "60", "name": "swf-example-activityType", "defaultTaskStartToCloseTimeout": "120", "defaultTaskScheduleToCloseTimeout": "180", "version": "1.0", "defaultTaskList": { "name": "swf-tasklist" }, "description": "integration test" }, "responseElements": null, "awsRegion": "us-east-1", "eventName": "RegisterActivityType", "userIdentity": { "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "type": "Root", "arn": "arn:aws:iam::244806523816:root", "principalId": "244806523816", "accountId": "244806523816" }, "eventSource": "swf.amazonaws.com", "requestID": "71811de3-d633-11e3-accd-9dbdf860ac2b", "userAgent": "aws-sdk-java/unknown-version Linux/2.6.18-164.el5 Java_HotSpot(TM)_64-Bit_Server_VM/24.45-b08", "sourceIPAddress": "10.61.88.189" }

RegisterDomain

下面是 RegisterDomain 的 CloudTrail 日志的示例:

{ "eventVersion": "1.01", "eventID": "e7e3c104-e748-4eda-90b5-827d44f4e459", "eventTime": "2014-05-07T22:03:38Z", "requestParameters": { "name": "swf-example-domain", "workflowExecutionRetentionPeriodInDays": "7", "description": "integration test domain" }, "responseElements": null, "awsRegion": "us-east-1", "eventName": "RegisterDomain", "userIdentity": { "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "type": "Root", "arn": "arn:aws:iam::244806523816:root", "principalId": "244806523816", "accountId": "244806523816" }, "eventSource": "swf.amazonaws.com", "requestID": "7133729f-d633-11e3-860e-45859b92f1b2", "userAgent": "aws-sdk-java/unknown-version Linux/2.6.18-164.el5 Java_HotSpot(TM)_64-Bit_Server_VM/24.45-b08", "sourceIPAddress": "10.61.88.189" }

RegisterWorkflowType

下面是 RegisterWorkflowType 的 CloudTrail 日志的示例:

{ "eventVersion": "1.01", "eventID": "31d2b900-a0c1-41a9-a09b-d5c8a57087eb", "eventTime": "2014-05-07T22:03:38Z", "requestParameters": { "defaultExecutionStartToCloseTimeout": "180", "domain": "swf-example-domain", "name": "swf-example-workflowType", "defaultChildPolicy": "TERMINATE", "defaultTaskStartToCloseTimeout": "NONE", "version": "1.0", "defaultTaskList": { "name": "swf-tasklist" } }, "responseElements": null, "awsRegion": "us-east-1", "eventName": "RegisterWorkflowType", "userIdentity": { "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "type": "Root", "arn": "arn:aws:iam::244806523816:root", "principalId": "244806523816", "accountId": "244806523816" }, "eventSource": "swf.amazonaws.com", "requestID": "71577518-d633-11e3-842e-67638fa0222f", "userAgent": "aws-sdk-java/unknown-version Linux/2.6.18-164.el5 Java_HotSpot(TM)_64-Bit_Server_VM/24.45-b08", "sourceIPAddress": "10.61.88.189" }