

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 使用日誌記錄 Amazon Kendra Intelligent Ranking API 呼叫 AWS CloudTrail
<a name="cloudtrail-intelligent-ranking"></a>

Amazon Kendra Intelligent Ranking 已與 服務整合 AWS CloudTrail，此服務提供由 Amazon Kendra Intelligent Ranking AWS 中的使用者、角色或服務所採取動作的記錄。CloudTrail 會將來自 Amazon Kendra Intelligent Ranking 的所有 API 呼叫擷取為事件，包括對 Amazon Kendra Intelligent Ranking APIs的程式碼呼叫。如果您建立線索，則可以啟用 CloudTrail 事件持續交付至 和 Amazon S3 儲存貯體，包括 Amazon Kendra Intelligent Ranking 的事件。即使您未設定追蹤，依然可以透過 CloudTrail 主控台中的**事件歷史記錄**檢視最新事件。您可以使用 CloudTrail 所收集的資訊，判斷對 Amazon Kendra Intelligent Ranking 提出的請求、提出請求的 IP 地址、提出請求的人員、提出請求的時間，以及其他詳細資訊。

若要進一步了解 CloudTrail，包括如何設定及啟用，請參閱[《AWS CloudTrail 使用者指南》](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-user-guide.html)。

## CloudTrail 中的 Amazon Kendra Intelligent Ranking 資訊
<a name="kendra-info-in-cloudtrail-intelligent-ranking"></a>

當您建立 AWS 帳戶時，會在您的帳戶上啟用 CloudTrail。當 Amazon Kendra Intelligent Ranking 中發生活動時，該活動會與 CloudTrail 事件歷史記錄中的其他服務 AWS 事件一起記錄在 CloudTrail 事件中。 ****您可以檢視、搜尋和下載 AWS 帳戶的最新事件。如需詳細資訊，請參閱[使用 CloudTrail 事件歷史記錄檢視事件](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/view-cloudtrail-events.html)。

若要持續記錄您 AWS 帳戶中的事件，包括 Amazon Kendra Intelligent Ranking 的事件，請建立追蹤。*線索*是一種組態，可讓 CloudTrail 以日誌檔案的形式將事件交付至指定的 S3 儲存貯體。根據預設，當您在主控台中建立線索時，線索會套用至所有 AWS 區域。線索會記錄 AWS 分割區中所有區域的事件，並將日誌檔案傳送到您指定的 S3 儲存貯體。此外，您可以設定其他 AWS 服務，以進一步分析和處理 CloudTrail 日誌中所收集的事件資料。如需詳細資訊，請參閱：
+ [建立追蹤的概觀](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-create-and-update-a-trail.html)
+ [CloudTrail 支援的服務和整合](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-aws-service-specific-topics.html#cloudtrail-aws-service-specific-topics-integrations)
+ [設定 CloudTrail 的 Amazon SNS 通知](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/getting_notifications_top_level.html)
+ [從多個區域接收 CloudTrail 日誌檔案](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/receive-cloudtrail-log-files-from-multiple-regions.html)，以及[從多個帳戶接收 CloudTrail 日誌檔案](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-receive-logs-from-multiple-accounts.html)

CloudTrail 會記錄 API [參考](https://docs.aws.amazon.com/kendra/latest/APIReference/API_Reference.html)中記錄的所有 Amazon Kendra Intelligent Ranking 動作。例如，對 的呼叫會在 CloudTrail 日誌檔案中`CreateRescoreExecutionPlan`產生項目。

每一筆事件或日誌專案都會包含產生請求者的資訊。如需詳細資訊，請參閱 [CloudTrail userIdentity 元素](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-user-identity.html)。

## 範例：Amazon Kendra Intelligent Ranking 日誌檔案項目
<a name="cloud-trail-intelligent-ranking-log-entry"></a>

*線索*是一種組態，允許將事件做為日誌檔案交付至指定的 S3 儲存貯體。CloudTrail 日誌檔案包含一或多個日誌專案。一個*事件*為任何來源提出的單一請求，並包含請求動作、請求的日期和時間、請求參數等資訊。CloudTrail 日誌檔並非依公有 API 呼叫的堆疊追蹤排序，因此不會以任何特定順序出現。

呼叫 `CreateRescoreExecutionPlan`操作會建立下列項目。

```
{
            "eventVersion": "1.08",
            "userIdentity": {
                "type": "{{AssumedRole}}",
                "principalId": "{{principal ID}}",
                "arn": "{{ARN}}",
                "accountId": "{{account ID}}",
                "accessKeyId": "{{access key ID}}",
                "sessionContext": {
                    "sessionIssuer": {
                        "type": "Role",
                        "principalId": "{{principal ID}}",
                        "arn": "{{ARN}}",
                        "accountId": "{{account ID}}",
                        "userName": "{{user name}}"
                    },
                    "webIdFederationData": {},
                    "attributes": {
                        "creationDate": "{{yyyy-mm-ddThh:mm:ssZ}}",
                        "mfaAuthenticated": "false"
                    }
                }
            },
            "eventTime": "{{yyyy-mm-ddThh:mm:ssZ}}",
            "eventSource": "kendra-ranking.amazonaws.com",
            "eventName": "{{CreateRescoreExecutionPlan}}",
            "awsRegion": "{{region}}",
            "sourceIPAddress": "{{source IP address}}",
            "userAgent": "{{user agent}}",
            "requestParameters": {
                "name": "{{name}}",
                "description": "{{description}}",
                "clientToken": "{{client token}}"
            },
            "responseElements": {
                "id": "{{rescore execution plan ID}}",
                "arn": "{{rescore execution plan ARN}}"
            },
            "requestID": "{{request ID}}",
            "eventID": "{{event ID}}",
            "readOnly": false,
            "eventType": "AwsApiCall",
            "managementEvent": true,
            "recipientAccountId": "{{account ID}}",
            "eventCategory": "{{Management}}",
            "tlsDetails": {
                "tlsVersion": "{{TLS version}}",
                "cipherSuite": "{{cipher suite}}",
                "clientProvidedHostHeader": "kendra-ranking.{{[region]}}.api.aws"
            }
        }
```