Cloud Logging 會使用 LogEntry
資料類型表示記錄,
定義所有記錄項目的通用資料,以及
Google Cloud 服務可能包含詳情請參閱 LogEntry 和 Fleet Engine API 記錄整合。
長日誌會分割為多個日誌項目。請參閱「處理分割作業 記錄。
記錄項目範例
以下範例顯示 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"
}
如要進一步瞭解 Logging 查詢語言,請參閱 Logging 查詢 語言。
如要瞭解如何使用記錄檔建立指標,請參閱總覽 記錄指標