Cloud Logging-Logstruktur
Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Cloud Logging stellt Logs mit dem Datentyp LogEntry
dar, der allgemeine Daten für alle Logeinträge sowie die spezifischen Nutzlasten definiert, die Google Cloud-Dienste enthalten können. Weitere Informationen finden Sie unter LogEntry.
Lange Logs werden in mehrere Logeinträge aufgeteilt. Weitere Informationen finden Sie in der Dokumentation unter Geteilte Logs verarbeiten.
Beispiel für Logeinträge
Das folgende Beispiel zeigt eine LogEntry
für das UpdateVehicle
-Log. Die RPC-Anfrage und -Antwort befinden sich im Feld 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"
}
Wenn ein RPC-Fehler zurückgegeben wird, wird das Feld responseVehicle
gelöscht und das Feld errorResponse
wird in jsonPayload
festgelegt und ausgefüllt.
{
"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"
}
Weitere Informationen zur Logging-Abfragesprache finden Sie unter Logging-Abfragesprache.
Informationen dazu, wie Sie mit Ihren Logs Messwerte erstellen können, finden Sie unter Übersicht über logbasierte Messwerte.
Nächste Schritte
Lange Logeinträge mit geteilten Logs verarbeiten
Sofern nicht anders angegeben, sind die Inhalte dieser Seite unter der Creative Commons Attribution 4.0 License und Codebeispiele unter der Apache 2.0 License lizenziert. Weitere Informationen finden Sie in den Websiterichtlinien von Google Developers. Java ist eine eingetragene Marke von Oracle und/oder seinen Partnern.
Zuletzt aktualisiert: 2025-08-31 (UTC).
[null,null,["Zuletzt aktualisiert: 2025-08-31 (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)."]]