本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
使用 Firehose 记录亚马逊数据 Firehose 通话 API AWS CloudTrail
Amazon Data Firehose 与一项服务集成,可记录用户 AWS CloudTrail、角色或 AWS 服务在 Amazon Data Firehose 中执行的操作。 CloudTrail 将所有对 Amazon Data Firehose 的API调用作为事件捕获。捕获的调用包括来自亚马逊数据 Firehose 控制台的调用和对亚马逊数据 Firehose 操作的代码调用。API如果您创建了跟踪,则可以允许将 CloudTrail 事件持续传输到 Amazon S3 存储桶,包括针对 Amazon Data Firehose 的事件。如果您未配置跟踪,您仍然可以在 CloudTrail 控制台的 “事件历史记录” 中查看最新的事件。通过收集的信息 CloudTrail,您可以确定向 Amazon Data Firehose 发出的请求、发出请求的 IP 地址、谁提出了请求、何时提出请求以及其他详细信息。
要了解更多信息 CloudTrail,包括如何配置和启用它,请参阅AWS CloudTrail 用户指南。
Firehose 信息在 CloudTrail
CloudTrail 在您创建 AWS 账户时已在您的账户上启用。当 Amazon Data Firehose 中出现支持的事件活动时,该活动会与其他 AWS 服务 CloudTrail事件一起记录在事件历史记录中。您可以在 AWS 账户中查看、搜索和下载最新事件。有关更多信息,请参阅使用事件历史记录查看 CloudTrail事件。
要持续记录您的 AWS 账户中的事件,包括 Amazon Data Firehose 的事件,请创建跟踪。跟踪允许 CloudTrail 将日志文件传输到 Amazon S3 存储桶。默认情况下,当您在控制台中创建跟踪时,该跟踪将应用于所有 AWS 区域。跟踪记录 AWS 分区中所有区域的事件,并将日志文件传送到您指定的 Amazon S3 存储桶。此外,您可以配置其他 AWS 服务,以进一步分析和处理 CloudTrail 日志中收集的事件数据。有关更多信息,请参阅下列内容:
Amazon Data Firehose 支持将以下操作作为事件记录在 CloudTrail 日志文件中:
每个事件或日记账条目都包含有关生成请求的人员信息。身份信息有助于您确定以下内容:
-
请求是使用 root 还是 AWS Identity and Access Management (IAM) 用户凭据发出。
-
请求是使用角色还是联合用户的临时安全凭证发出的。
-
请求是否由其他 AWS 服务发出。
有关更多信息,请参阅CloudTrail userIdentity 元素。
示例:Firehose 日志文件条目
跟踪是一种配置,允许将事件作为日志文件传输到您指定的 Amazon S3 存储桶。 CloudTrail 日志文件包含一个或多个日志条目。一个事件表示来自任何源的一个请求,包括有关所请求的操作、操作的日期和时间、请求参数等方面的信息。 CloudTrail 日志文件不是公共API调用的有序堆栈跟踪,因此它们不会按任何特定的顺序出现。
以下示例显示了一个演示CreateDeliveryStream
、、DescribeDeliveryStream
ListDeliveryStreams
UpdateDestination
、和DeleteDeliveryStream
操作的 CloudTrail 日志条目。
{ "Records":[ { "eventVersion":"1.02", "userIdentity":{ "type":"IAMUser", "principalId":"AKIAIOSFODNN7EXAMPLE", "arn":"arn:aws:iam::111122223333:user/CloudTrail_Test_User", "accountId":"111122223333", "accessKeyId":"AKIAI44QH8DHBEXAMPLE", "userName":"CloudTrail_Test_User" }, "eventTime":"2016-02-24T18:08:22Z", "eventSource":"firehose.amazonaws.com", "eventName":"CreateDeliveryStream", "awsRegion":"us-east-1", "sourceIPAddress":"127.0.0.1", "userAgent":"aws-internal/3", "requestParameters":{ "deliveryStreamName":"TestRedshiftStream", "redshiftDestinationConfiguration":{ "s3Configuration":{ "compressionFormat":"GZIP", "prefix":"prefix", "bucketARN":"arn:aws:s3:::amzn-s3-demo-bucket", "roleARN":"arn:aws:iam::111122223333:role/Firehose", "bufferingHints":{ "sizeInMBs":3, "intervalInSeconds":900 }, "encryptionConfiguration":{ "kMSEncryptionConfig":{ "aWSKMSKeyARN":"arn:aws:kms:us-east-1:key" } } }, "clusterJDBCURL":"jdbc:redshift://example.abc123.us-west-2.redshift.amazonaws.com:5439/dev", "copyCommand":{ "copyOptions":"copyOptions", "dataTableName":"dataTable" }, "password":"", "username":"", "roleARN":"arn:aws:iam::111122223333:role/Firehose" } }, "responseElements":{ "deliveryStreamARN":"arn:aws:firehose:us-east-1:111122223333:deliverystream/TestRedshiftStream" }, "requestID":"958abf6a-db21-11e5-bb88-91ae9617edf5", "eventID":"875d2d68-476c-4ad5-bbc6-d02872cfc884", "eventType":"AwsApiCall", "recipientAccountId":"111122223333" }, { "eventVersion":"1.02", "userIdentity":{ "type":"IAMUser", "principalId":"AKIAIOSFODNN7EXAMPLE", "arn":"arn:aws:iam::111122223333:user/CloudTrail_Test_User", "accountId":"111122223333", "accessKeyId":"AKIAI44QH8DHBEXAMPLE", "userName":"CloudTrail_Test_User" }, "eventTime":"2016-02-24T18:08:54Z", "eventSource":"firehose.amazonaws.com", "eventName":"DescribeDeliveryStream", "awsRegion":"us-east-1", "sourceIPAddress":"127.0.0.1", "userAgent":"aws-internal/3", "requestParameters":{ "deliveryStreamName":"TestRedshiftStream" }, "responseElements":null, "requestID":"aa6ea5ed-db21-11e5-bb88-91ae9617edf5", "eventID":"d9b285d8-d690-4d5c-b9fe-d1ad5ab03f14", "eventType":"AwsApiCall", "recipientAccountId":"111122223333" }, { "eventVersion":"1.02", "userIdentity":{ "type":"IAMUser", "principalId":"AKIAIOSFODNN7EXAMPLE", "arn":"arn:aws:iam::111122223333:user/CloudTrail_Test_User", "accountId":"111122223333", "accessKeyId":"AKIAI44QH8DHBEXAMPLE", "userName":"CloudTrail_Test_User" }, "eventTime":"2016-02-24T18:10:00Z", "eventSource":"firehose.amazonaws.com", "eventName":"ListDeliveryStreams", "awsRegion":"us-east-1", "sourceIPAddress":"127.0.0.1", "userAgent":"aws-internal/3", "requestParameters":{ "limit":10 }, "responseElements":null, "requestID":"d1bf7f86-db21-11e5-bb88-91ae9617edf5", "eventID":"67f63c74-4335-48c0-9004-4ba35ce00128", "eventType":"AwsApiCall", "recipientAccountId":"111122223333" }, { "eventVersion":"1.02", "userIdentity":{ "type":"IAMUser", "principalId":"AKIAIOSFODNN7EXAMPLE", "arn":"arn:aws:iam::111122223333:user/CloudTrail_Test_User", "accountId":"111122223333", "accessKeyId":"AKIAI44QH8DHBEXAMPLE", "userName":"CloudTrail_Test_User" }, "eventTime":"2016-02-24T18:10:09Z", "eventSource":"firehose.amazonaws.com", "eventName":"UpdateDestination", "awsRegion":"us-east-1", "sourceIPAddress":"127.0.0.1", "userAgent":"aws-internal/3", "requestParameters":{ "destinationId":"destinationId-000000000001", "deliveryStreamName":"TestRedshiftStream", "currentDeliveryStreamVersionId":"1", "redshiftDestinationUpdate":{ "roleARN":"arn:aws:iam::111122223333:role/Firehose", "clusterJDBCURL":"jdbc:redshift://example.abc123.us-west-2.redshift.amazonaws.com:5439/dev", "password":"", "username":"", "copyCommand":{ "copyOptions":"copyOptions", "dataTableName":"dataTable" }, "s3Update":{ "bucketARN":"arn:aws:s3:::amzn-s3-demo-bucket-update", "roleARN":"arn:aws:iam::111122223333:role/Firehose", "compressionFormat":"GZIP", "bufferingHints":{ "sizeInMBs":3, "intervalInSeconds":900 }, "encryptionConfiguration":{ "kMSEncryptionConfig":{ "aWSKMSKeyARN":"arn:aws:kms:us-east-1:key" } }, "prefix":"arn:aws:s3:::amzn-s3-demo-bucket" } } }, "responseElements":null, "requestID":"d549428d-db21-11e5-bb88-91ae9617edf5", "eventID":"1cb21e0b-416a-415d-bbf9-769b152a6585", "eventType":"AwsApiCall", "recipientAccountId":"111122223333" }, { "eventVersion":"1.02", "userIdentity":{ "type":"IAMUser", "principalId":"AKIAIOSFODNN7EXAMPLE", "arn":"arn:aws:iam::111122223333:user/CloudTrail_Test_User", "accountId":"111122223333", "accessKeyId":"AKIAI44QH8DHBEXAMPLE", "userName":"CloudTrail_Test_User" }, "eventTime":"2016-02-24T18:10:12Z", "eventSource":"firehose.amazonaws.com", "eventName":"DeleteDeliveryStream", "awsRegion":"us-east-1", "sourceIPAddress":"127.0.0.1", "userAgent":"aws-internal/3", "requestParameters":{ "deliveryStreamName":"TestRedshiftStream" }, "responseElements":null, "requestID":"d85968c1-db21-11e5-bb88-91ae9617edf5", "eventID":"dd46bb98-b4e9-42ff-a6af-32d57e636ad1", "eventType":"AwsApiCall", "recipientAccountId":"111122223333" } ] }