

Amazon Machine Learning サービスの更新や、その新しいユーザーの受け入れは行っていません。このドキュメントは既存のユーザー向けに提供されていますが、更新は終了しています。詳細については、「[Amazon Machine Learning とは](https://docs.aws.amazon.com/machine-learning/latest/dg/what-is-amazon-machine-learning.html)」を参照してください。

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# を使用した Amazon ML API コールのログ記録 AWS CloudTrail
<a name="logging-using-cloudtrail"></a>

Amazon Machine Learning (Amazon ML) は AWS CloudTrail、Amazon ML のユーザー、ロール、または サービスによって実行されたアクションを記録する AWS サービスである と統合されています。CloudTrail は、Amazon ML へのすべての API コールをイベントとしてキャプチャします。キャプチャされた呼び出しには、Amazon ML コンソールからの呼び出しと、Amazon ML API オペレーションへのコード呼び出しが含まれます。証跡を作成する場合は、Amazon ML のイベントなど、Amazon S3 バケットへの CloudTrail イベントの継続的な配信を有効にすることができます。証跡を設定しない場合でも、CloudTrail コンソールの **[イベント履歴]** で最新のイベントを表示できます。CloudTrail で収集された情報を使用して、Amazon ML に対するリクエスト、リクエスト元の IP アドレス、リクエスト者、リクエスト日時などの詳細を確認できます。

設定や有効化の方法など、CloudTrail の詳細については、「[AWS CloudTrail ユーザーガイド](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/)」を参照してください。

## CloudTrail 内の Amazon ML 情報
<a name="service-name-info-in-cloudtrail"></a>

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

Amazon ML のイベントなど、 AWS アカウント内のイベントの継続的な記録については、証跡を作成します。追跡により、CloudTrailはログファイルをSimple Storage Service (Amazon S3) バケットに配信できます。デフォルトでは、コンソールで作成した証跡がすべての AWS リージョンに適用されます。証跡は、 AWS パーティション内のすべてのリージョンからのイベントをログに記録し、指定した Amazon S3 バケットにログファイルを配信します。さらに、CloudTrail ログで収集されたイベントデータをより詳細に分析し、それに基づいて行動するように、他の AWS サービスを設定できます。詳細については、次を参照してください: 
+ [証跡の作成のための概要](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)」

Amazon ML は、CloudTrail ログファイルのイベントとして以下のアクションのログ付けをサポートします。
+ [AddTags](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_AddTags.html)
+ [CreateBatchPrediction](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_CreateBatchPrediction.html)
+ [CreateDataSourceFromRDS](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_CreateDataSourceFromRDS.html)
+ [CreateDataSourceFromRedshift](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_CreateDataSourceFromRedshift.html)
+ [CreateDataSourceFromS3](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_CreateDataSourceFromS3.html)
+ [CreateEvaluation](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_CreateEvaluation.html)
+ [CreateMLModel](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_CreateMLModel.html)
+ [CreateRealtimeEndpoint](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_CreateRealtimeEndpoint.html)
+ [DeleteBatchPrediction](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_DeleteBatchPrediction.html)
+ [DeleteDataSource](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_DeleteDataSource.html)
+ [DeleteEvaluation](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_DeleteEvaluation.html)
+ [DeleteMLModel](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_DeleteMLModel.html)
+ [DeleteRealtimeEndpoint](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_DeleteRealtimeEndpoint.html)
+ [DeleteTags](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_DeleteTags.html)
+ [DescribeTags](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_DescribeTags.html)
+ [UpdateBatchPrediction](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_UpdateBatchPrediction.html)
+ [UpdateDataSource](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_UpdateDataSource.html)
+ [UpdateEvaluation](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_UpdateEvaluation.html)
+ [UpdateMLModel](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_UpdateMLModel.html)

次の Amazon ML オペレーションでは、認証情報を含むリクエストパラメータが使用されます。これらのリクエストが CloudTrail に送信される前に、認証情報は 3 つのアスタリスク (「\$1\$1\$1」) に置き換えられます。
+ [CreateDataSourceFromRDS](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_CreateDataSourceFromRDS.html)
+ [CreateDataSourceFromRedshift](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_CreateDataSourceFromRedshift.html)

次の Amazon ML オペレーション が Amazon ML コンソールで実行される場合、属性 `ComputeStatistics` は CloudTrail ログの `RequestParameters` コンポーネントに含まれません。
+ [CreateDataSourceFromRedshift](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_CreateDataSourceFromRedshift.html)
+ [CreateDataSourceFromS3](https://docs.aws.amazon.com/machine-learning/latest/APIReference/API_CreateDataSourceFromS3.html)

各イベントまたはログエントリには、誰がリクエストを生成したかという情報が含まれます。アイデンティティ情報は、以下を判別するのに役立ちます。
+ リクエストがルートまたは AWS Identity and Access Management (IAM) ユーザー認証情報を使用して行われたかどうか。
+ リクエストがロールまたはフェデレーションユーザーのテンポラリなセキュリティ認証情報を使用して行われたかどうか。
+ リクエストが別の AWS サービスによって行われたかどうか。

詳細については、[CloudTrail userIdentity 要素](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudtrail-event-reference-user-identity.html)を参照してください。

## 例: Amazon ML ログファイルのエントリ
<a name="understanding-service-name-entries"></a>

 「トレイル」は、指定した Amazon S3 バケットにイベントをログファイルとして配信するように設定できます。CloudTrail のログファイルは、単一か複数のログエントリを含みます。イベントは任意ソースからの単一リクエストを表し、リクエストされたアクション、アクションの日時、リクエストパラメータなどの情報を含みます。CloudTrail ログファイルは、パブリック API コールの順序付けられたスタックトレースではないため、特定の順序では表示されません。

以下の例は、 アクションを示す CloudTrail ログエントリです。

```
{
    "Records": [
        {
            "eventVersion": "1.03",
            "userIdentity": {
                "type": "IAMUser",
                "principalId": "EX_PRINCIPAL_ID",
                "arn": "arn:aws:iam::012345678910:user/Alice",
                "accountId": "012345678910",
                "accessKeyId": "EXAMPLE_KEY_ID",
                "userName": "Alice"
            },
            "eventTime": "2015-11-12T15:04:02Z",
            "eventSource": "machinelearning.amazonaws.com",
            "eventName": "CreateDataSourceFromS3",
            "awsRegion": "us-east-1",
            "sourceIPAddress": "127.0.0.1",
            "userAgent": "console.amazonaws.com",
            "requestParameters": {
                "data": {
                    "dataLocationS3": "s3://aml-sample-data/banking-batch.csv",
                    "dataSchema": "{\"version\":\"1.0\",\"rowId\":null,\"rowWeight\":null,
                        \"targetAttributeName\":null,\"dataFormat\":\"CSV\",
                        \"dataFileContainsHeader\":false,\"attributes\":[
                          {\"attributeName\":\"age\",\"attributeType\":\"NUMERIC\"},
                          {\"attributeName\":\"job\",\"attributeType\":\"CATEGORICAL\"},
                          {\"attributeName\":\"marital\",\"attributeType\":\"CATEGORICAL\"},
                          {\"attributeName\":\"education\",\"attributeType\":\"CATEGORICAL\"},
                          {\"attributeName\":\"default\",\"attributeType\":\"CATEGORICAL\"},
                          {\"attributeName\":\"housing\",\"attributeType\":\"CATEGORICAL\"},
                          {\"attributeName\":\"loan\",\"attributeType\":\"CATEGORICAL\"},
                          {\"attributeName\":\"contact\",\"attributeType\":\"CATEGORICAL\"},
                          {\"attributeName\":\"month\",\"attributeType\":\"CATEGORICAL\"},
                          {\"attributeName\":\"day_of_week\",\"attributeType\":\"CATEGORICAL\"},
                          {\"attributeName\":\"duration\",\"attributeType\":\"NUMERIC\"},
                          {\"attributeName\":\"campaign\",\"attributeType\":\"NUMERIC\"},
                          {\"attributeName\":\"pdays\",\"attributeType\":\"NUMERIC\"},
                          {\"attributeName\":\"previous\",\"attributeType\":\"NUMERIC\"},
                          {\"attributeName\":\"poutcome\",\"attributeType\":\"CATEGORICAL\"},
                          {\"attributeName\":\"emp_var_rate\",\"attributeType\":\"NUMERIC\"},
                          {\"attributeName\":\"cons_price_idx\",\"attributeType\":\"NUMERIC\"},
                          {\"attributeName\":\"cons_conf_idx\",\"attributeType\":\"NUMERIC\"},
                          {\"attributeName\":\"euribor3m\",\"attributeType\":\"NUMERIC\"},
                          {\"attributeName\":\"nr_employed\",\"attributeType\":\"NUMERIC\"}
                        ],\"excludedAttributeNames\":[]}"
                },
                "dataSourceId": "exampleDataSourceId",
                "dataSourceName": "Banking sample for batch prediction"
            },
            "responseElements": {
                "dataSourceId": "exampleDataSourceId"
            },
            "requestID": "9b14bc94-894e-11e5-a84d-2d2deb28fdec",
            "eventID": "f1d47f93-c708-495b-bff1-cb935a6064b2",
            "eventType": "AwsApiCall",
            "recipientAccountId": "012345678910"
        },
        {
            "eventVersion": "1.03",
            "userIdentity": {
                "type": "IAMUser",
                "principalId": "EX_PRINCIPAL_ID",
                "arn": "arn:aws:iam::012345678910:user/Alice",
                "accountId": "012345678910",
                "accessKeyId": "EXAMPLE_KEY_ID",
                "userName": "Alice"
            },
            "eventTime": "2015-11-11T15:24:05Z",
            "eventSource": "machinelearning.amazonaws.com",
            "eventName": "CreateBatchPrediction",
            "awsRegion": "us-east-1",
            "sourceIPAddress": "127.0.0.1",
            "userAgent": "console.amazonaws.com",
            "requestParameters": {
                "batchPredictionName": "Batch prediction: ML model: Banking sample",
                "batchPredictionId": "exampleBatchPredictionId",
                "batchPredictionDataSourceId": "exampleDataSourceId",
                "outputUri": "s3://EXAMPLE_BUCKET/BatchPredictionOutput/",
                "mLModelId": "exampleModelId"
            },
            "responseElements": {
                "batchPredictionId": "exampleBatchPredictionId"
            },
            "requestID": "3e18f252-8888-11e5-b6ca-c9da3c0f3955",
            "eventID": "db27a771-7a2e-4e9d-bfa0-59deee9d936d",
            "eventType": "AwsApiCall",
            "recipientAccountId": "012345678910"
        }
    ]
}
```