Cloud Logging 記錄檔結構

Cloud Logging 會使用 LogEntry 資料類型表示記錄,該類型會定義所有記錄項目的通用資料,以及 Google Cloud 服務可納入的特定酬載。詳情請參閱 LogEntry

長日誌會分割為多個日誌項目。請參閱本說明文件中的「處理分割記錄」。

記錄項目範例

以下範例顯示 UpdateVehicle 記錄的 LogEntry。RPC 要求和回應位於 jsonPayload 欄位內。

    {
      "insertId": "c6b85fbc927343fc8a85338c57a65733",
      "jsonPayload": {
        "request": {
          "header": {4},
          "updateMask": "deviceSettings",
          "vehicleId": "uniqueVehicleId",
          "vehicle": {2}
        },
        "response": {
          "name": "providers/example-project-id/vehicles/uniqueVehicleId",
          "availableCapacity": 2,
          "state": "VEHICLE_STATE_OFFLINE",
          "maximumCapacity": 2,
          "vehicleType": {1},
          "supportedTrips": {1}
        },
        "@type": "type.googleapis.com/maps.fleetengine.v1.UpdateVehicleLog"
      },
      "resource": {
        "type": "fleetengine.googleapis.com/Fleet",
        "labels": {2}
      },
      "timestamp": "2021-01-01T00:00:00.000000000Z",
      "labels": {2},
      "logName": "projects/example-project-id/logs/fleetengine.googleapis.com%2Fupdate_vehicle",
      "receiveTimestamp": "2021-01-01T00:00:00.000000000Z"
    }

如果傳回 RPC 錯誤,系統會清除 responseVehicle 欄位,並在 jsonPayload 中設定及填入 errorResponse 欄位。

    {
      "insertId": "c6b85fbc927343fc8a85338c57a65733",
      "jsonPayload": {
        "errorResponse": {
          "httpStatusCode": 404,
          "code": "NOT_FOUND",
          "message": "No entity with id invalidVehicleId exists"
        },
        "@type": "type.googleapis.com/maps.fleetengine.v1.UpdateVehicleLog",
        "request": {
          "vehicle": {3},
          "updateMask": "deviceSettings",
          "vehicleId": "fakeVehicleId",
          "header": {4}
        }
      },
      "resource": {
        "type": "fleetengine.googleapis.com/Fleet",
        "labels": {2}
      },
      "timestamp": "2021-01-01T00:00:00.000000000Z",
      "severity": "ERROR",
      "labels": {2}
      "logName": "projects/example-project-id/logs/fleetengine.googleapis.com%2Fupdate_vehicle",
      "receiveTimestamp": "2021-01-01T00:00:00.000000000Z"
    }

如要進一步瞭解記錄查詢語言,請參閱「記錄查詢語言」。

如要瞭解如何使用記錄建立指標,請參閱「記錄指標總覽」。

後續步驟

使用分割記錄處理長的記錄項目