

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

# 使用 記錄特徵商店操作 AWS CloudTrail
<a name="feature-store-logging-using-cloudtrail"></a>

Amazon SageMaker Feature Store 已與 整合 AWS CloudTrail，此服務可提供使用者、角色或特徵商店中 AWS 服務所採取動作的記錄。CloudTrail 會擷取此頁面上列出的特徵商店的所有 API 呼叫。記錄的事件包括來自特徵商店資源管理和資料操作的 API 呼叫。若您建立追蹤，便可將 CloudTrail 事件從特徵商店持續交付至 Amazon S3 儲存貯體。您可以利用 CloudTrail 所收集的資訊來判斷向特徵商店發出的請求，以及發出請求的 IP 地址、人員、時間和其他詳細資訊。

若要進一步了解 CloudTrail，請參閱[「AWS CloudTrail 使用者指南」](https://docs.aws.amazon.com/awscloudtrail/latest/userguide)。

## 管理事件
<a name="feature-store-logging-using-cloudtrail-management-events"></a>

管理事件會擷取在您 AWS 帳戶中特徵商店資源上執行的操作。例如，如果使用者建立或刪除特徵商店，則從管理事件產生的記錄可讓您查看具體情況。下列 API 透過 Amazon SageMaker Feature Store 記錄管理事件。
+ `CreateFeatureGroup`
+ `DeleteFeatureGroup`
+ `DescribeFeatureGroup`
+ `UpdateFeatureGroup`

根據預設，當您建立帳戶時，Amazon SageMaker API 呼叫和管理事件會記錄下來，如[使用 記錄 Amazon SageMaker AI API 呼叫 AWS CloudTrail](logging-using-cloudtrail.md)中所述。如需詳細資訊，請參閱[記錄追蹤的管理事件](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-management-events-with-cloudtrail.html)。

## 資料事件
<a name="feature-store-logging-using-cloudtrail-data-events"></a>

資料事件會擷取在您的 AWS 帳戶中使用特徵商店資源執行的資料平面操作。例如，如果使用者在特徵群組內新增或刪除特徵商店，則從資料事件產生的記錄可讓您查看具體情況。下列 API 透過 Amazon SageMaker Feature Store 記錄資料事件。
+ `BatchGetRecord`
+ `DeleteRecord`
+ `GetRecord`
+ `PutRecord`

根據預設，CloudTrail 追蹤*不會*記錄資料事件。若要啟動資料事件的記錄功能，請在 CloudTrail 中開啟資料平面 API 活動的日誌紀錄功能。如需詳細資訊，請參閱[記錄追蹤的資料事件](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html)。

 以下為 `PutRecord` API 呼叫的 CloudTrail 事件範例：

```
{
    "eventVersion": "1.08",
    "userIdentity": {
        "type": "IAMUser",
        "principalId": "USERPRINCIPALID",
        "arn": "arn:aws:iam::123456789012:user/user",
        "accountId": "123456789012",
        "accessKeyId": "USERACCESSKEYID",
        "userName": "your-user-name"
    },
    "eventTime": "2023-01-01T01:00:00Z",
    "eventSource": "sagemaker.amazonaws.com",
    "eventName": "PutRecord",
    "awsRegion": "us-east-1",
    "sourceIPAddress": "192.0.2.0",
    "userAgent": "your-user-agent",
    "requestParameters": {
        "featureGroupName": "your-feature-group-name"
    },
    "responseElements": null,
    "requestID": "request-id",
    "eventID": "event-id",
    "readOnly": false,
    "resources": [
        {
            "accountId": "123456789012",
            "type": "AWS::SageMaker::FeatureGroup",
            "ARN": "arn:aws:sagemaker:us-east-1:123456789012:feature-group/your-feature-group-name"
        }
    ],
    "eventType": "AwsApiCall",
    "managementEvent": false,
    "recipientAccountId": "123456789012",
    "eventCategory": "Data",
    "tlsDetails": {
        ...
    }
}
```