使用记录亚马逊 Kinesis Data API Streams 的通话 AWS CloudTrail - Amazon Kinesis Data Streams

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

使用记录亚马逊 Kinesis Data API Streams 的通话 AWS CloudTrail

Amazon Kinesis Data Streams AWS CloudTrail与一项服务集成,该服务提供用户、角色或 AWS 服务在 Kinesis Data Streams 中采取的操作的记录。 CloudTrail 将所有对 Kinesis Data Streams 的API调用作为事件捕获。捕获的调用包括来自 Kinesis Data Streams 控制台的调用和对 Kinesis Data Streams 操作的代码调用。API如果您创建了跟踪,则可以允许将 CloudTrail 事件持续传输到 Amazon S3 存储桶,包括 Kinesis Data Streams 的事件。如果您未配置跟踪,您仍然可以在 CloudTrail 控制台的事件历史记录中查看最新的事件。使用收集的信息 CloudTrail,您可以确定向 Kinesis Data Streams 发出的请求、发出请求的 IP 地址、谁发出了请求、何时发出请求以及其他详细信息。

要了解更多信息 CloudTrail,包括如何配置和启用它,请参阅AWS CloudTrail 用户指南

Kinesis Data Streams 将信息流入 CloudTrail

CloudTrail 在您创建 AWS 账户时已在您的账户上启用。当 Kinesis Dat CloudTrail a Streams 中出现支持的事件活动时,该活动会 AWS 与其他服务事件一起记录在事件历史记录。您可以在自己的 AWS 账户中查看、搜索和下载最近发生的事件。有关更多信息,请参阅使用事件历史记录查看 CloudTrail事件

要持续记录 AWS 账户中的事件,包括 Kinesis Data Streams 的事件,请创建跟踪。跟踪允许 CloudTrail 将日志文件传输到 Amazon S3 存储桶。默认情况下,当您在控制台中创建跟踪时,该跟踪将应用于所有 AWS 区域。跟踪记录 AWS 分区中所有区域的事件,并将日志文件传送到您指定的 Amazon S3 存储桶。此外,您可以配置其他 AWS 服务,以进一步分析和处理 CloudTrail 日志中收集的事件数据。有关更多信息,请参阅下列内容:

Kinesis Data Streams 支持将以下操作作为事件记录 CloudTrail 在日志文件中:

每个事件或日记账条目都包含有关生成请求的人员信息。身份信息有助于您确定以下内容:

  • 请求是使用 root 还是 AWS Identity and Access Management (IAM) 用户凭据发出。

  • 请求是使用角色还是联合用户的临时安全凭证发出的。

  • 请求是否由其他 AWS 服务发出。

有关更多信息,请参阅CloudTrail userIdentity 元素

示例:Kinesis Data Streams 日志文件条目

跟踪是一种配置,允许将事件作为日志文件传输到您指定的 Amazon S3 存储桶。 CloudTrail 日志文件包含一个或多个日志条目。一个事件表示来自任何源的一个请求,包括有关所请求的操作、操作的日期和时间、请求参数等方面的信息。 CloudTrail 日志文件不是公共API调用的有序堆栈跟踪,因此它们不会按任何特定的顺序出现。

以下示例显示了一个演示CreateStream、、、DescribeStreamListStreamsDeleteStreamSplitShard、和MergeShards操作的 CloudTrail 日志条目。

{ "Records": [ { "eventVersion": "1.01", "userIdentity": { "type": "IAMUser", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::012345678910:user/Alice", "accountId": "012345678910", "accessKeyId": "EXAMPLE_KEY_ID", "userName": "Alice" }, "eventTime": "2014-04-19T00:16:31Z", "eventSource": "kinesis.amazonaws.com", "eventName": "CreateStream", "awsRegion": "us-east-1", "sourceIPAddress": "127.0.0.1", "userAgent": "aws-sdk-java/unknown-version Linux/x.xx", "requestParameters": { "shardCount": 1, "streamName": "GoodStream" }, "responseElements": null, "requestID": "db6c59f8-c757-11e3-bc3b-57923b443c1c", "eventID": "b7acfcd0-6ca9-4ee1-a3d7-c4e8d420d99b" }, { "eventVersion": "1.01", "userIdentity": { "type": "IAMUser", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::012345678910:user/Alice", "accountId": "012345678910", "accessKeyId": "EXAMPLE_KEY_ID", "userName": "Alice" }, "eventTime": "2014-04-19T00:17:06Z", "eventSource": "kinesis.amazonaws.com", "eventName": "DescribeStream", "awsRegion": "us-east-1", "sourceIPAddress": "127.0.0.1", "userAgent": "aws-sdk-java/unknown-version Linux/x.xx", "requestParameters": { "streamName": "GoodStream" }, "responseElements": null, "requestID": "f0944d86-c757-11e3-b4ae-25654b1d3136", "eventID": "0b2f1396-88af-4561-b16f-398f8eaea596" }, { "eventVersion": "1.01", "userIdentity": { "type": "IAMUser", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::012345678910:user/Alice", "accountId": "012345678910", "accessKeyId": "EXAMPLE_KEY_ID", "userName": "Alice" }, "eventTime": "2014-04-19T00:15:02Z", "eventSource": "kinesis.amazonaws.com", "eventName": "ListStreams", "awsRegion": "us-east-1", "sourceIPAddress": "127.0.0.1", "userAgent": "aws-sdk-java/unknown-version Linux/x.xx", "requestParameters": { "limit": 10 }, "responseElements": null, "requestID": "a68541ca-c757-11e3-901b-cbcfe5b3677a", "eventID": "22a5fb8f-4e61-4bee-a8ad-3b72046b4c4d" }, { "eventVersion": "1.01", "userIdentity": { "type": "IAMUser", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::012345678910:user/Alice", "accountId": "012345678910", "accessKeyId": "EXAMPLE_KEY_ID", "userName": "Alice" }, "eventTime": "2014-04-19T00:17:07Z", "eventSource": "kinesis.amazonaws.com", "eventName": "DeleteStream", "awsRegion": "us-east-1", "sourceIPAddress": "127.0.0.1", "userAgent": "aws-sdk-java/unknown-version Linux/x.xx", "requestParameters": { "streamName": "GoodStream" }, "responseElements": null, "requestID": "f10cd97c-c757-11e3-901b-cbcfe5b3677a", "eventID": "607e7217-311a-4a08-a904-ec02944596dd" }, { "eventVersion": "1.01", "userIdentity": { "type": "IAMUser", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::012345678910:user/Alice", "accountId": "012345678910", "accessKeyId": "EXAMPLE_KEY_ID", "userName": "Alice" }, "eventTime": "2014-04-19T00:15:03Z", "eventSource": "kinesis.amazonaws.com", "eventName": "SplitShard", "awsRegion": "us-east-1", "sourceIPAddress": "127.0.0.1", "userAgent": "aws-sdk-java/unknown-version Linux/x.xx", "requestParameters": { "shardToSplit": "shardId-000000000000", "streamName": "GoodStream", "newStartingHashKey": "11111111" }, "responseElements": null, "requestID": "a6e6e9cd-c757-11e3-901b-cbcfe5b3677a", "eventID": "dcd2126f-c8d2-4186-b32a-192dd48d7e33" }, { "eventVersion": "1.01", "userIdentity": { "type": "IAMUser", "principalId": "EX_PRINCIPAL_ID", "arn": "arn:aws:iam::012345678910:user/Alice", "accountId": "012345678910", "accessKeyId": "EXAMPLE_KEY_ID", "userName": "Alice" }, "eventTime": "2014-04-19T00:16:56Z", "eventSource": "kinesis.amazonaws.com", "eventName": "MergeShards", "awsRegion": "us-east-1", "sourceIPAddress": "127.0.0.1", "userAgent": "aws-sdk-java/unknown-version Linux/x.xx", "requestParameters": { "streamName": "GoodStream", "adjacentShardToMerge": "shardId-000000000002", "shardToMerge": "shardId-000000000001" }, "responseElements": null, "requestID": "e9f9c8eb-c757-11e3-bf1d-6948db3cd570", "eventID": "77cf0d06-ce90-42da-9576-71986fec411f" } ] }