プラットフォームのログを使用

このページでは、Cloud Logging の一部として AML AI によって生成されたプラットフォーム ログを使用する方法について説明します。AML AI は、Logging API サービス名 financialservices.googleapis.com を使用して、次のアクティビティを記録します。

  • エンジン構成の作成(調整)
  • モデルの作成(トレーニング)
  • バックテスト オペレーション
  • 予測オペレーション

準備

ログを表示および管理するには、適切な IAM 権限とロールがあることを確認してください。

プラットフォーム ロギングの有効化ステータス

AML AI のプラットフォーム ログは常にアクティブです(オフにすることはできません)。

ログの重大度

AML AI ログエントリでは、次の 3 つの重大度レベルを使用します。

  • オペレーションの開始時または成功時に送信されるエントリの場合は NOTICE
  • 失敗したオペレーションの終了に関するエントリの場合は ERROR
  • オペレーションの進行状況に関するエントリの場合は INFO

プラットフォームのログを表示する

プラットフォームのログを表示するには、次の手順に沿って操作します。

Console

Google Cloud コンソールでプラットフォーム ログを表示するには:

  1. ログ エクスプローラに移動します。

    ログ エクスプローラに移動

  2. 適切な Google Cloud プロジェクトを選択します。

  3. [クエリ] フィールドに次のクエリコマンドを入力します。

    logName=("projects/PROJECT_ID/logs/financialservices.googleapis.com%2Fbacktest" OR
    "projects/PROJECT_ID/logs/financialservices.googleapis.com%2Fengine_config_creation" OR
    "projects/PROJECT_ID/logs/financialservices.googleapis.com%2Fmodel_creation" OR
    "projects/PROJECT_ID/logs/financialservices.googleapis.com%2Fprediction")
    

    ここで

    PROJECT_ID は、デバッグまたはモニタリングするプロジェクトの ID です。例: my-project

  4. [クエリを実行] をクリックします。

ログ エクスプローラの詳細については、ログ エクスプローラの概要ログ エクスプローラの使用をご覧ください。

gcloud

gcloud コマンドライン ツールは、Cloud Logging へのコマンドライン インターフェースを提供します。

プロジェクトのログを表示するには、次のコマンドを実行します。

gcloud logging read 'logName=("projects/PROJECT_ID/logs/financialservices.googleapis.com%2Fbacktest" OR
"projects/PROJECT_ID/logs/financialservices.googleapis.com%2Fengine_config_creation" OR
"projects/PROJECT_ID/logs/financialservices.googleapis.com%2Fmodel_creation" OR
"projects/PROJECT_ID/logs/financialservices.googleapis.com%2Fprediction")' --project=PROJECT_ID

ここで PROJECT_ID は Google Cloud プロジェクトの ID です。

Cloud Logging で gcloud ツールを使用する際の詳細については、gcloud logging をご覧ください。

プラットフォームのログについて

このセクションでは、AML AI の特定のプラットフォーム ログについて説明します。

START ログ

オペレーションの実行が開始されると、eventKind=START を含むログが生成されます。

予測実行の開始ログの例を次に示します。

jsonPayload:
  '@type': type.googleapis.com/google.cloud.financialservices.logging.v1.PredictionLog
  engineVersion: projects/PROJECT_ID/locations/REGION_ID/instances/INSTANCE_ID/engineVersions/ENGINE_VERSION_ID
  eventKind: START
  predictionResult:
    dataset: projects/PROJECT_ID/locations/REGION_ID/instances/INSTANCE_ID/datasets/DATASET_ID
    endTime: '2023-05-31T00:00:00Z'
    model: projects/PROJECT_ID/locations/REGION_ID/instances/INSTANCE_ID/models/MODEL_ID
    outputs:
      explainabilityDestination:
        tableUri: bq://PROJECT_ID.DATASET_ID.EXPLAINABILITY_TABLE_ID
        writeDisposition: WRITE_EMPTY
      predictionDestination:
        tableUri: bq://PROJECT_ID.DATASET_ID.PREDICTION_TABLE_ID
        writeDisposition: WRITE_EMPTY
logName: projects/PROJECT_ID/logs/financialservices.googleapis.com%2Fprediction
operation:
  first: true
  id: projects/PROJECT_NUMBER/locations/REGION_ID/operations/OPERATION_ID
  producer: financialservices.googleapis.com
receiveTimestamp: '2023-06-07T12:30:48.417285528Z'
resource:
  labels:
    instance_id: INSTANCE_ID
    location: REGION_ID
    prediction_result_id: PREDICTION_ID
    resource_container: projects/PROJECT_NUMBER
  type: financialservices.googleapis.com/PredictionResult

ログ エクスプローラの [クエリ] フィールドにコマンドを追加して、表示されるログを絞り込むことができます。

次のコマンドを追加して、選択したデータセットで開始されたすべての予測実行を表示します。

logName="projects/PROJECT_ID/logs/financialservices.googleapis.com%2Fprediction" AND
jsonPayload.predictionResult.dataset="projects/PROJECT_ID/locations/REGION_ID/instances/INSTANCE_ID/datasets/DATASET_ID" AND
jsonPayload.eventKind="START"

PROGRESS ログ

eventKind=PROGRESS を含むログは、オペレーションの進行状況を表します。

モデルの作成ログの例を次に示します。completedTaskCounttaskCount を使用して、モデルのトレーニングの進捗状況を見積もることができます。

jsonPayload:
  '@type': type.googleapis.com/google.cloud.financialservices.logging.v1.ModelCreationLog
  completedTaskCount: 11
  engineVersion: projects/PROJECT_ID/locations/REGION_ID/instances/INSTANCE_ID/engineVersions/ENGINE_VERSION_ID
  eventKind: PROGRESS
  model:
    endTime: '2023-05-31T00:00:00Z'
    engineConfig: projects/PROJECT_ID/locations/REGION_ID/instances/INSTANCE_ID/engineConfigs/ENGINE_CONFIG_ID
    engineVersion: projects/PROJECT_ID/locations/REGION_ID/instances/INSTANCE_ID/engineVersions/ENGINE_VERSION_ID
    lineOfBusiness: RETAIL
    primaryDataset: projects/PROJECT_ID/locations/REGION_ID/instances/INSTANCE_ID/datasets/DATASET_ID
    state: CREATING
  partyCount: '9246'
  taskCount: 16
logName: projects/PROJECT_ID/logs/financialservices.googleapis.com%2Fmodel_creation
operation:
  id: projects/PROJECT_NUMBER/locations/REGION_ID/operations/OPERATION_ID
  producer: financialservices.googleapis.com
receiveTimestamp: '2023-06-07T13:57:00.454668648Z'
resource:
  labels:
    instance_id: INSTANCE_ID
    location: REGION_ID
    model_id: MODEL_ID
    resource_container: projects/PROJECT_NUMBER
  type: financialservices.googleapis.com/Model
severity: INFO
timestamp: '2023-06-07T13:56:59.772973055Z'

END ログ

オペレーションが終了すると、eventKind=END を含むログが生成されます。

以下に、エンジン構成の作成に失敗したログの例を示します。 提供されたデータセット内の誤ったデータに関するエラーが含まれています。

jsonPayload:
  '@type': type.googleapis.com/google.cloud.financialservices.logging.v1.EngineConfigCreationLog
  completedTaskCount: 3
  engineConfig:
    engineVersion: projects/PROJECT_ID/locations/REGION_ID/instances/INSTANCE_ID/engineVersions/ENGINE_VERSION_ID
    lineOfBusiness: RETAIL
    performanceTarget:
      partyInvestigationsPerPeriodHint: '100'
    state: CREATING
    tuning:
      endTime: '2019-04-30T00:00:00Z'
      primaryDataset: projects/PROJECT_ID/locations/REGION_ID/instances/INSTANCE_ID/datasets/DATASET_ID
  eventKind: END
  operationStatus:
    code: 9
    details:
    - '@type': type.googleapis.com/google.rpc.ErrorInfo
      domain: financialservices.googleapis.com
      metadata:
        count: '15'
        data_field: party_id, validity_start_time
        data_table: party
        description: There is a duplicate primary key value in the database resulting
          in unique key violation. Note that for tables with validity_start_time,
          the primary key includes validity_start_time
        test: GROUP BY party_id, validity_start_time HAVING count(1) > 1
      reason: DUPLICATE_PRIMARY_KEY
    message: Dataset validation failed with 1 error. See error details for individual
      violations.
  partyCount: '9246'
  taskCount: 16
logName: projects/PROJECT_ID/logs/financialservices.googleapis.com%2Fengine_config_creation
operation:
  id: projects/PROJECT_NUMBER/locations/REGION_ID/operations/OPERATION_ID
  last: true
  producer: financialservices.googleapis.com
receiveTimestamp: '2023-06-07T14:26:30.214382295Z'
resource:
  labels:
    engine_config_id: ENGINE_CONFIG_ID
    instance_id: INSTANCE_ID
    location: REGION_ID
    resource_container: projects/PROJECT_NUMBER
  type: financialservices.googleapis.com/EngineConfig
severity: ERROR
timestamp: '2023-06-07T14:26:29.670913895Z'

すべてのエンジン構成作成のエラーログを表示するには、以下のフィルタを使用します。

logName="projects/PROJECT_ID/logs/financialservices.googleapis.com%2Fengine_config_creation" AND
severity>=ERROR