

# S3 Vectors の AWS CloudTrail を使用したログ記録
<a name="s3-vectors-logging"></a>

Amazon S3 Vectors は、AWS CloudTrail と統合されています。このサービスは、ユーザー、ロール、または AWS のサービスによって実行されたアクションを記録するサービスです。CloudTrail は、S3 Vectors のすべての API コールをイベントとしてキャプチャします。CloudTrail で収集された情報を使用して、S3 Vectors に対するリクエスト、リクエスト元の IP アドレス、リクエストの作成日時、その他の詳細を確認できます。サポートされているイベントアクティビティが S3 Vectors で発生すると、そのアクティビティは CloudTrail イベントに記録されます。CloudTrail 証跡を使用して、S3 Vectors の管理イベントとデータイベントを記録できます。

CloudTrail に関する詳細は、「[CloudTrail ユーザーガイド](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/)」を参照してください。

## CloudTrail の S3 Vectors 情報
<a name="s3-vectors-logging-information"></a>

AWS アカウントを作成すると、そのアカウントに対して CloudTrail が有効になります。S3 Vectors でアクティビティが発生すると、そのアクティビティはイベント履歴の他の AWS サービスのイベントとともに CloudTrail イベントに記録されます。最近のイベントは、AWS アカウントで表示、検索、ダウンロードできます。詳細については、[CloudTrail イベント履歴でのイベントの表示](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/view-cloudtrail-events.html)を参照してください。

S3 Vectors のイベントを含めた AWS アカウント内のイベントの継続的な記録については、証跡を作成します。[Trail] (追跡) により、CloudTrail はログファイルを Simple Storage Service (Amazon S3) バケットに配信できます。デフォルトでは、コンソールで証跡を作成すると、すべての AWS リージョンに証跡が適用されます。証跡は、AWS パーティションのすべてのリージョンからのイベントをログに記録し、指定した Amazon S3 バケットにログファイルを配信します。さらに、CloudTrail ログで収集したイベントデータをより詳細に分析し、それに基づいて対応するため、他の AWS サービスを構成できます。詳細については、「*CloudTrail ユーザーガイド*」の、「[Overview for Creating a Trail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-create-and-update-a-trail.html)」、「[Configuring Amazon SNS Notifications for CloudTrail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/getting-notifications-top-level.html)」、「[Receiving CloudTrail Log Files from Multiple Regions](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/receive-cloudtrail-log-files-from-multiple-regions.html)」、および「[Receiving CloudTrail Log Files from Multiple Accounts](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-receive-logs-from-multiple-accounts.html)」を参照してください。

すべての S3 Vectors API アクションが CloudTrail によってログに記録され、[Amazon S3 Vectors](https://docs.aws.amazon.com/AmazonS3/latest/API/API_Operations_Amazon_S3_Vectors.html) API リファレンスに文書化されています。例えば、[CreateVectorBucket](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_CreateVectorBucket.html)、[CreateIndex](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_CreateIndex.html)、[QueryVectors](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_QueryVectors.html) アクションの呼び出しは、CloudTrail ログファイルにエントリを生成します。

各イベントまたはログエントリには、リクエストの生成者に関する情報が含まれます。同一性情報は次の判断に役立ちます。
+ リクエストが、ルートと IAM ユーザー認証情報のどちらを使用して送信されたか。
+ リクエストがロールまたはフェデレーションユーザーの一時的なセキュリティ認証情報を使用して行われたかどうか。
+ リクエストが別の AWS サービスによって行われたかどうか。

詳細については、「*CloudTrail ユーザーガイド*」の「[CloudTrail userIdentity エレメント](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-user-identity.html)」を参照してください。

## S3 Vectors の CloudTrail 管理イベント
<a name="s3-vectors-logging-management-events"></a>

管理イベントでは、AWS アカウントのリソースで実行される管理オペレーションについての情報が得られます。これらのイベントは、コントロールプレーンオペレーションとも呼ばれます。CloudTrail は、デフォルトで管理イベントをログ記録します。

S3 Vectors の場合、CloudTrail は次の管理イベントを記録します。
+ [CreateVectorBucket](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_CreateVectorBucket.html)
+ [DeleteVectorBucket](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_DeleteVectorBucket.html)
+ [GetVectorBucket](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_GetVectorBucket.html)
+ [ListVectorBuckets](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_ListVectorBuckets.html)
+ [PutVectorBucketPolicy](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_PutVectorBucketPolicy.html)
+ [GetVectorBucketPolicy](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_GetVectorBucketPolicy.html)
+ [DeleteVectorBucketPolicy](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_DeleteVectorBucketPolicy.html)
+ [CreateIndex](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_CreateIndex.html)
+ [DeleteIndex](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_DeleteIndex.html)
+ [GetIndex](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_GetIndex.html)
+ [ListIndexes](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_ListIndexes.html)

S3 Vectors の管理イベントとデータイベントの `eventSource` は `s3vectors.amazonaws.com` です。

管理イベントの詳細については、「*CloudTrail ユーザーガイド*」の「[Logging management events](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-management-events-with-cloudtrail.html)」を参照してください。

## S3 Vectors の CloudTrail データイベント
<a name="s3-vectors-logging-data-events"></a>

データイベントでは、リソース上またはリソース内で実行されたリソースオペレーションについての情報が得られます。これらのイベントは、データプレーンオペレーションとも呼ばれます。デフォルトでは、CloudTrail はデータイベントをログ記録しません。ただし、S3 Vectors リソースのデータイベントをログに記録するように証跡を設定できます。

データイベントをログに記録するように証跡を設定するときは、S3 Vectors リソースタイプを指定できます。S3 Vectors は、データイベントに対して次のリソースタイプをサポートしています。
+ `AWS::S3Vectors::VectorBucket` - 指定されたベクトルバケット内のすべてのベクトルインデックスのデータイベントをログに記録します
+ `AWS::S3Vectors::Index` - 特定のベクトルインデックスのデータイベントをログに記録します

S3 Vectors の場合、CloudTrail は次のデータイベントを記録します。

ベクトルデータオペレーション。
+ [PutVectors](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_PutVectors.html) - ベクトルインデックスにベクトルが追加されたときにログに記録します
+ [GetVectors](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_GetVectors.html) - ベクトルインデックスからベクトルが取得されたときにログに記録します
+ [DeleteVectors](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_DeleteVectors.html) - ベクトルインデックスからベクトルが削除されたときにログに記録します
+ [ListVectors](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_ListVectors.html) - ベクトルインデックス内のベクトルがリストされたときにログに記録します
+ [QueryVectors](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_QueryVectors.html) - ベクトルインデックスで類似度クエリが実行されたときにログに記録します

S3 Vectors データイベントの `eventSource` は `s3vectors.amazonaws.com` です。

## S3 Vectors のデータイベントログ記録の有効化
<a name="s3-vectors-logging-enabling-data-events"></a>

CloudTrail 証跡を作成または更新するときに、S3 Vectors リソースのデータイベントログ記録を有効にできます。アカウント内のすべてのベクトルバケットとベクトルインデックスのログ記録を指定することも、個々のベクトルバケットまたはベクトルインデックスを指定することもできます。証跡の作成に関する詳細な手順については、「*CloudTrail ユーザーガイド*」の「[Creating a trail](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-create-a-trail-using-the-console-first-time.html)」を参照してください。

すべての S3 Vectors リソースのデータイベントログ記録を有効にするには。
+ 証跡を作成または更新するときは、**[データイベント]** を選択します。
+ **[リソースタイプ]** で、`AWS::S3Vectors::VectorBucket` を選択します。
+ **[リソース ARN]** に、`arn:aws:s3vectors:_:_:bucket/*` と入力してすべてのベクトルバケットのイベントをログに記録するか、個々のベクトルバケット ARN (例: `arn:aws:s3vectors:us-east-1:123456789012:bucket/amzn-s3-demo-vector-bucket`) を指定します。

特定のベクトルインデックスのデータイベントログ記録を有効にするには。
+ 証跡を作成または更新するときは、**[データイベント]** を選択します。
+ **[リソースタイプ]** で、`AWS::S3Vectors::Index` を選択します。
+ **[リソース ARN]** に、`arn:aws:s3vectors:us-east-1:123456789012:bucket/amzn-s3-demo-vector-bucket/index/my-index` などの特定のベクトルインデックスの ARN を入力します。

データイベントの詳細については、「*CloudTrail ユーザーガイド*」の「[Logging data events](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html)」を参照してください。

**Topics**
+ [CloudTrail の S3 Vectors 情報](#s3-vectors-logging-information)
+ [S3 Vectors の CloudTrail 管理イベント](#s3-vectors-logging-management-events)
+ [S3 Vectors の CloudTrail データイベント](#s3-vectors-logging-data-events)
+ [S3 Vectors のデータイベントログ記録の有効化](#s3-vectors-logging-enabling-data-events)
+ [S3 Vectors の CloudTrail ログファイルの例](s3-vectors-cloudtrail-log-example.md)

# S3 Vectors の CloudTrail ログファイルの例
<a name="s3-vectors-cloudtrail-log-example"></a>

以下は、S3 Vectors データイベントの CloudTrail ログエントリの例です。データイベントは、ベクトルインデックス内のベクトルデータにオペレーションを実行するときに記録されます。

## 例: `GetVectors` データイベントの CloudTrail ログファイル
<a name="s3-vectors-cloudtrail-getvectors-example"></a>

```
{
    "eventVersion": "1.11",
    "userIdentity": {
        "type": "IAMUser",
        "principalId": "123456789012",
        "arn": "arn:aws:iam::123456789012:user/myUserName",
        "accountId": "123456789012",
        "accessKeyId": "AKIAIOSFODNN7EXAMPLE",
        "userName": "myUserName"
    },
    "eventTime": "2024-11-22T17:12:25Z",
    "eventSource": "s3vectors.amazonaws.com",
    "eventName": "GetVectors",
    "awsRegion": "us-east-1",
    "sourceIPAddress": "192.0.2.0",
    "userAgent": "[aws-cli/2.18.5]",
    "requestParameters": {
        "vectorBucketName": "amzn-s3-demo-vector-bucket",
        "returnMetadata": "false",
        "indexName": "111aa1111-22bb-33cc-44dd-5555eee66ffff",
        "returnData": "false"
    },            
    "responseElements": null,
    "additionalEventData": {
        "SignatureVersion": "SigV4",
        "cipherSuite": "ECDHE-RSA-AES128-GCM-SHA256"
    },
    "requestID": "07D681123BD12AED",
    "eventID": "f2b287f3-0df1-1234-a2f4-c4bdfed47657",
    "readOnly": true,
    "resources": [{
        "accountId": "123456789012",
        "type": "AWS::S3Vectors::VectorBucket",
        "ARN": "arn:aws:s3vectors:us-east-1:123456789012:bucket/amzn-s3-demo-vector-bucket"
    }, {
        "accountId": "123456789012",
        "type": "AWS::S3Vectors::Index",
        "ARN": "arn:aws:s3vectors:us-east-1:123456789012:bucket/amzn-s3-demo-vector-bucket/index/111aa1111-22bb-33cc-44dd-5555eee66ffff"
    }],
    "eventType": "AwsApiCall",
    "managementEvent": false,
    "recipientAccountId": "444455556666",
    "eventCategory": "Data",
    "tlsDetails": {
        "tlsVersion": "TLSv1.2",
        "cipherSuite": "ECDHE-RSA-AES128-GCM-SHA256",
        "clientProvidedHostHeader": "client-host"
    }
}
```

## S3 Vectors のログファイルエントリを理解する
<a name="s3-vectors-cloudtrail-understanding"></a>

CloudTrail のログファイルは、単一か複数のログエントリを含みます。イベントは任意ソースからの単一リクエストを表し、リクエストされたアクション、アクションの日時、リクエストパラメータなどの情報を含みます。CloudTrail ログファイルは、パブリック API 呼び出しの順序付けられたスタックトレースではないため、特定の順序では表示されません。

S3 Vectors CloudTrail ログエントリには、次の主要な要素が含まれています。
+ **eventSource** – 常に S3 Vectors イベントの `s3vectors.amazonaws.com`。
+ **eventName** - 実行された S3 Vectors API オペレーション。
+ **eventCategory** - コントロールプレーンオペレーションの `Management` またはデータプレーンオペレーションの `Data`。
+ **readOnly**: 読み取りオペレーションの `true` ([GetVectors](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_GetVectors.html)、[QueryVectors](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_QueryVectors.html)、[ListVectors](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_ListVectors.html) など) および書き込みオペレーションの `false` ([PutVectors](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_PutVectors.html)、[DeleteVectors](https://docs.aws.amazon.com/AmazonS3/latest/API/API_S3VectorBuckets_DeleteVectors.html))。
+ **リソース** – ベクトルバケットやベクトルインデックスなど、オペレーションに関与する S3 Vectors リソース。
+ **requestParameters** - リクエストとともに送信されたパラメータ。
+ **responseElements** - S3 Vectors サービスによって返されるレスポンス要素。