本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。
使用 记录 Amazon Keyspaces API 调用Amazon CloudTrail
亚马逊 Keyspaces 与Amazon CloudTrail,提供用户、角色或用户所执行操作的记录的服务。Amazon亚马逊 Keyspaces 中的服务。CloudTrail将 Amazon Keyspaces 的数据定义语言 (DDL) API 调用捕获为事件。捕获的调用包括来自 Amazon Keyspaces 控制台的调用和对 Amazon Keyspaces API 操作的代码调用。
如果您创建跟踪,则可以使CloudTrail发生到 Amazon Simple Storage Service (Amazon S3) 存储桶的事件,包括 Amazon Keyspaces 的事件。
如果您不配置跟踪,则仍可在 CloudTrail 控制台的 Event history (事件历史记录) 中查看最新事件。使用收集的信息CloudTrail中,您可以确定向 Amazon Keyspaces 发出了什么请求、发出请求的 IP 地址、何人发出的请求、请求的发出时间以及其他详细信息。
要了解有关 CloudTrail 的更多信息,请参阅 Amazon CloudTrail 用户指南。
中的 Amazon Keyspaces 信息CloudTrail
CloudTrail在上启用了Amazon Web Services 账户在您创建账户时。当 Amazon Keyspaces 中发生 DDL 活动时,该活动将记录在CloudTrail活动以及其他Amazon中的服务事件事件史记录. 下表显示了为亚马逊 Keyspaces 记录的 DDL 语句。请注意,数据操作语言 (DML) 语句未登录CloudTrail.
CloudTrail eventName |
Statement | CQL 操作 | AmazonSDK 操作 |
|---|---|---|---|
|
CreateTable |
DDL |
|
|
|
CreateKeyspace |
DDL |
|
|
|
DropKeyspace |
DDL |
|
|
|
DropTable |
DDL |
|
|
|
AlterTable |
DDL |
|
|
|
不CloudTrail事件 |
DML |
|
|
已登录的每个操作CloudTrail包括始终以 CQL 查询语言表示的请求参数。
您可以在中查看、搜索和下载最新事件Amazon Web Services 账户. 有关更多信息,请参阅使用 CloudTrail 事件历史记录查看事件。
要持续记录中的事件Amazon Web Services 账户,包括 Amazon Keyspaces 的事件,请创建跟踪。一个踪迹启用CloudTrail将日志文件传送到 Amazon S3 存储桶。预设情况下,在控制台中创建跟踪时,此跟踪应用于所有 Amazon 区域。此跟踪记录在 Amazon 分区中记录所有区域中的事件,并将日志文件传送至您指定的 Simple Storage Service(Amazon S3)存储桶。此外,您可以配置其他 Amazon 服务,进一步分析在 CloudTrail 日志中收集的事件数据并采取行动。
有关更多信息,请参阅 Amazon CloudTrail 用户指南 中的以下主题:
每个事件或日志条目都包含有关生成请求的人员信息。身份信息可帮助您确定以下内容:
-
请求是使用根用户凭证还是 Amazon Identity and Access Management (IAM) 用户凭证发出的
-
请求是使用角色还是联合身份用户的临时安全凭证发出的
-
请求是否由其它 Amazon 服务发出
有关更多信息,请参阅 CloudTrail userIdentity 元素。
了解 Amazon Keyspaces 日志文件条目
跟踪记录是一种配置,可用于将事件作为日志文件传送到您指定的 Simple Storage Service(Amazon S3)存储桶。CloudTrail 日志文件包含一个或多个日志条目。一个事件表示来自任何源的一个请求,包括有关所请求的操作、操作的日期和时间、请求参数等方面的信息。CloudTrail 日志文件不是公用 API 调用的有序堆栈跟踪,因此它们不会按任何特定顺序显示。
以下示例显示了一个 CloudTrail 日志条目,该条目演示了 CreateKeyspace、DropKeyspace、CreateTable 和 DropTable 操作。
{ "Records": [ { "eventVersion": "1.05", "userIdentity": { "type": "AssumedRole", "principalId": "AKIAIOSFODNN7EXAMPLE:alice", "arn": "arn:aws:sts::111122223333:assumed-role/users/alice", "accountId": "111122223333", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AKIAIOSFODNN7EXAMPLE", "arn": "arn:aws:iam::111122223333:role/Admin", "accountId": "111122223333", "userName": "Admin" }, "webIdFederationData": {}, "attributes": { "mfaAuthenticated": "false", "creationDate": "2020-01-15T18:47:56Z" } } }, "eventTime": "2020-01-15T18:53:04Z", "eventSource": "cassandra.amazonaws.com", "eventName": "CreateKeyspace", "awsRegion": "us-east-2", "sourceIPAddress": "52.95.24.72", "userAgent": "Cassandra Client/ProtocolV4", "requestParameters": { "rawQuery": "\n\tCREATE KEYSPACE \"mykeyspace\"\n\tWITH\n\t\tREPLICATION = {'class': 'SingleRegionStrategy'}\n\t\t", "keyspaceName": "mykeyspace" }, "responseElements": null, "requestID": "bfa3e75d-bf4d-4fc0-be5e-89d15850eb41", "eventID": "d25beae8-f611-4229-877a-921557a07bb9", "readOnly": false, "resources": [ { "accountId": "111122223333", "type": "AWS::Cassandra::Keyspace", "ARN": "arn:aws:cassandra:us-east-2:111122223333:/keyspace/mykeyspace/" } ], "eventType": "AwsApiCall", "apiVersion": "3.4.4", "recipientAccountId": "111122223333" }, { "eventVersion": "1.05", "userIdentity": { "type": "AssumedRole", "principalId": "AKIAIOSFODNN7EXAMPLE:alice", "arn": "arn:aws:sts::111122223333:assumed-role/users/alice", "accountId": "111122223333", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AKIAIOSFODNN7EXAMPLE", "arn": "arn:aws:iam::111122223333:role/Admin", "accountId": "111122223333", "userName": "Admin" }, "webIdFederationData": {}, "attributes": { "mfaAuthenticated": "false", "creationDate": "2020-01-15T18:47:56Z" } } }, "eventTime": "2020-01-15T19:28:39Z", "eventSource": "cassandra.amazonaws.com", "eventName": "DropKeyspace", "awsRegion": "us-east-2", "sourceIPAddress": "52.95.24.73", "userAgent": "Cassandra Client/ProtocolV4", "requestParameters": { "rawQuery": "DROP KEYSPACE \"mykeyspace\"", "keyspaceName": "mykeyspace" }, "responseElements": null, "requestID": "66f3d86a-56ae-4c29-b46f-abcd489ed86b", "eventID": "e5aebeac-e1dd-41e3-a515-84fe6aaabd7b", "readOnly": false, "resources": [ { "accountId": "111122223333", "type": "AWS::Cassandra::Keyspace", "ARN": "arn:aws:cassandra:us-east-2:111122223333:/keyspace/mykeyspace/" } ], "eventType": "AwsApiCall", "apiVersion": "3.4.4", "recipientAccountId": "111122223333" }, { "eventVersion": "1.05", "userIdentity": { "type": "AssumedRole", "principalId": "AKIAIOSFODNN7EXAMPLE:alice", "arn": "arn:aws:sts::111122223333:assumed-role/users/alice", "accountId": "111122223333", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AKIAIOSFODNN7EXAMPLE", "arn": "arn:aws:iam::111122223333:role/Admin", "accountId": "111122223333", "userName": "Admin" }, "webIdFederationData": {}, "attributes": { "mfaAuthenticated": "false", "creationDate": "2020-01-15T18:47:56Z" } } }, "eventTime": "2020-01-15T18:55:24Z", "eventSource": "cassandra.amazonaws.com", "eventName": "CreateTable", "awsRegion": "us-east-2", "sourceIPAddress": "52.95.24.72", "userAgent": "Cassandra Client/ProtocolV4", "requestParameters": { "rawQuery": "\n\tCREATE TABLE \"mykeyspace\".\"mytable\"(\n\t\t\"ID\" int,\n\t\t\"username\" text,\n\t\t\"email\" text,\n\t\t\"post_type\" text,\n\t\tPRIMARY KEY((\"ID\", \"username\", \"email\")))", "keyspaceName": "mykeyspace", "tableName": "mytable" }, "responseElements": null, "requestID": "5f845963-70ea-4988-8a7a-2e66d061aacb", "eventID": "fe0dbd2b-7b34-4675-a30c-740f9d8d73f9", "readOnly": false, "resources": [ { "accountId": "111122223333", "type": "AWS::Cassandra::Table", "ARN": "arn:aws:cassandra:us-east-2:111122223333:/keyspace/mykeyspace/table/mytable" } ], "eventType": "AwsApiCall", "apiVersion": "3.4.4", "recipientAccountId": "111122223333" }, { "eventVersion": "1.05", "userIdentity": { "type": "AssumedRole", "principalId": "AKIAIOSFODNN7EXAMPLE:alice", "arn": "arn:aws:sts::111122223333:assumed-role/users/alice", "accountId": "111122223333", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "AKIAIOSFODNN7EXAMPLE", "arn": "arn:aws:iam::111122223333:role/Admin", "accountId": "111122223333", "userName": "Admin" }, "webIdFederationData": {}, "attributes": { "mfaAuthenticated": "false", "creationDate": "2020-01-15T18:47:56Z" } } }, "eventTime": "2020-01-15T19:27:59Z", "eventSource": "cassandra.amazonaws.com", "eventName": "DropTable", "awsRegion": "us-east-2", "sourceIPAddress": "52.95.24.66", "userAgent": "Cassandra Client/ProtocolV4", "requestParameters": { "rawQuery": "DROP TABLE \"mykeyspace\".\"mytable\"", "keyspaceName": "mykeyspace", "tableName": "mytable" }, "responseElements": null, "requestID": "025501b0-3582-437e-9d18-8939e9ef262f", "eventID": "1a5cbedc-4e38-4889-8475-3eab98de0ffd", "readOnly": false, "resources": [ { "accountId": "111122223333", "type": "AWS::Cassandra::Table", "ARN": "arn:aws:cassandra:us-east-2:111122223333:/keyspace/mykeyspace/table/mytable" } ], "eventType": "AwsApiCall", "apiVersion": "3.4.4", "recipientAccountId": "111122223333" } ] }