使用平台記錄檔

本頁面說明如何使用 AML AI 產生的平台記錄,做為 Cloud Logging 的一部分。AML AI 會使用 Logging API 服務名稱 financialservices.googleapis.com 記錄下列活動:

  • 建立引擎設定 (調整)
  • 建立模型 (訓練)
  • 回測作業
  • 預測作業

事前準備

如要查看及管理記錄,請確認您具備正確的身分與存取權管理權限和角色

平台記錄啟用狀態

反洗錢 AI 的平台記錄一律處於啟用狀態 (無法關閉)。

記錄嚴重性

AML AI 記錄項目會使用三種嚴重性層級:

  • NOTICE:在作業開始或成功時傳送的項目
  • ERROR 是關於失敗作業結束的項目
  • INFO 用於作業進度項目

查看平台記錄檔

如要查看平台記錄,請按照下列指示操作:

控制台

如要在 Google Cloud 控制台中查看平台記錄,請按照下列步驟操作:

  1. 前往「Logs Explorer」(記錄檔探索工具):

    前往「Logs Explorer」

  2. 選取適當的 Google Cloud 專案。

  3. 在「Query」欄位中輸入下列查詢指令:

    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。

如要進一步瞭解如何搭配使用 gcloud 工具和 Cloud Logging,請參閱 gcloud logging

瞭解平台記錄檔

本節說明如何瞭解 AML AI 的特定平台記錄。

開始記錄

作業開始執行時,系統會產生含有 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"

進度記錄

含有 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'

結束記錄

作業結束時,系統會產生含有 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