Структура журнала Cloud Logging
Оптимизируйте свои подборки
Сохраняйте и классифицируйте контент в соответствии со своими настройками.
Cloud Logging представляет журналы с использованием типа данных LogEntry
, который определяет общие данные для всех записей журнала, а также конкретные полезные данные, которые могут включать сервисы Google Cloud. Подробнее см. в разделе LogEntry .
Длинные журналы разделяются на несколько записей. См. раздел «Обработка разделённых журналов» в этой документации.
Примеры записей журнала
В следующем примере показана LogEntry
журнала UpdateVehicle
. Запрос и ответ 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
очищается, а поле errorResponse
устанавливается и заполняется в jsonPayload
.
{
"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"
}
Дополнительную информацию о языке запросов журналирования см. в разделе Язык запросов журналирования .
Информацию о том, как использовать журналы для создания метрик, см . в разделе Обзор метрик на основе журналов .
Что дальше?
Обрабатывайте длинные записи журнала с помощью раздельных журналов .
Если не указано иное, контент на этой странице предоставляется по лицензии Creative Commons "С указанием авторства 4.0", а примеры кода – по лицензии Apache 2.0. Подробнее об этом написано в правилах сайта. Java – это зарегистрированный товарный знак корпорации Oracle и ее аффилированных лиц.
Последнее обновление: 2025-08-29 UTC.
[null,null,["Последнее обновление: 2025-08-29 UTC."],[[["\u003cp\u003eCloud Logging utilizes the \u003ccode\u003eLogEntry\u003c/code\u003e data type to represent logs, encompassing common data and service-specific payloads, with details available in the provided LogEntry documentation link.\u003c/p\u003e\n"],["\u003cp\u003eExcessively long logs are divided into multiple log entries, and guidance on handling these split logs is provided in the linked documentation.\u003c/p\u003e\n"],["\u003cp\u003eExample log entries demonstrate the structure of a \u003ccode\u003eLogEntry\u003c/code\u003e for an \u003ccode\u003eUpdateVehicle\u003c/code\u003e log, including request and response details within the \u003ccode\u003ejsonPayload\u003c/code\u003e field.\u003c/p\u003e\n"],["\u003cp\u003eIn cases of RPC errors, the \u003ccode\u003eresponseVehicle\u003c/code\u003e field is cleared, and the \u003ccode\u003eerrorResponse\u003c/code\u003e field is populated within \u003ccode\u003ejsonPayload\u003c/code\u003e, containing error details like status code and message.\u003c/p\u003e\n"],["\u003cp\u003eAdditional resources are available for understanding the logging query language and utilizing logs to create metrics, with links provided for further exploration.\u003c/p\u003e\n"]]],["Cloud Logging uses the `LogEntry` data type, containing common data and service-specific payloads. Long logs are divided into multiple entries. The `jsonPayload` field within a `LogEntry` holds RPC requests and responses. If an RPC error occurs, the `responseVehicle` field is cleared, and the `errorResponse` field within the `jsonPayload` is populated with the error details. Logs can be queried using the Logging query language and used to create metrics.\n"],null,["Cloud Logging represents logs using the `LogEntry` data type, which\ndefines common data for all log entries as well as the specific payloads that\nGoogle Cloud services can include. For details, see [LogEntry](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry).\n\nLong logs are split into multiple log entries. See [Handle split\nlogs](/maps/documentation/mobility/operations/cloud-logging/split-logs) in this documentation.\n\nExample log entries\n\nThe following example shows a `LogEntry` for the `UpdateVehicle` log. The RPC\nrequest and response are located inside the `jsonPayload` field. \n\n {\n \"insertId\": \"c6b85fbc927343fc8a85338c57a65733\",\n \"jsonPayload\": {\n \"request\": {\n \"header\": {4},\n \"updateMask\": \"deviceSettings\",\n \"vehicleId\": \"uniqueVehicleId\",\n \"vehicle\": {2}\n },\n \"response\": {\n \"name\": \"providers/example-project-id/vehicles/uniqueVehicleId\",\n \"availableCapacity\": 2,\n \"state\": \"VEHICLE_STATE_OFFLINE\",\n \"maximumCapacity\": 2,\n \"vehicleType\": {1},\n \"supportedTrips\": {1}\n },\n \"@type\": \"type.googleapis.com/maps.fleetengine.v1.UpdateVehicleLog\"\n },\n \"resource\": {\n \"type\": \"fleetengine.googleapis.com/Fleet\",\n \"labels\": {2}\n },\n \"timestamp\": \"2021-01-01T00:00:00.000000000Z\",\n \"labels\": {2},\n \"logName\": \"projects/example-project-id/logs/fleetengine.googleapis.com%2Fupdate_vehicle\",\n \"receiveTimestamp\": \"2021-01-01T00:00:00.000000000Z\"\n }\n\nIf an RPC error is returned, the `responseVehicle` field is cleared, and the\n`errorResponse` field is set and populated within `jsonPayload`. \n\n {\n \"insertId\": \"c6b85fbc927343fc8a85338c57a65733\",\n \"jsonPayload\": {\n \"errorResponse\": {\n \"httpStatusCode\": 404,\n \"code\": \"NOT_FOUND\",\n \"message\": \"No entity with id invalidVehicleId exists\"\n },\n \"@type\": \"type.googleapis.com/maps.fleetengine.v1.UpdateVehicleLog\",\n \"request\": {\n \"vehicle\": {3},\n \"updateMask\": \"deviceSettings\",\n \"vehicleId\": \"fakeVehicleId\",\n \"header\": {4}\n }\n },\n \"resource\": {\n \"type\": \"fleetengine.googleapis.com/Fleet\",\n \"labels\": {2}\n },\n \"timestamp\": \"2021-01-01T00:00:00.000000000Z\",\n \"severity\": \"ERROR\",\n \"labels\": {2}\n \"logName\": \"projects/example-project-id/logs/fleetengine.googleapis.com%2Fupdate_vehicle\",\n \"receiveTimestamp\": \"2021-01-01T00:00:00.000000000Z\"\n }\n\nFor more information about the logging query language, see [Logging query\nlanguage](https://cloud.google.com/logging/docs/view/logging-query-language).\n\nFor information about how you can use your logs to create metrics, see [Overview\nof logs-based metrics](https://cloud.google.com/logging/docs/logs-based-metrics).\n\nWhat's next\n\n[Handle long log entries with split logs](/maps/documentation/mobility/operations/cloud-logging/split-logs)."]]