Cloud Logging log structure

  • Cloud Logging utilizes the LogEntry data type to represent logs, encompassing common data and service-specific payloads, with details available in the provided LogEntry documentation link.

  • Excessively long logs are divided into multiple log entries, and guidance on handling these split logs is provided in the linked documentation.

  • Example log entries demonstrate the structure of a LogEntry for an UpdateVehicle log, including request and response details within the jsonPayload field.

  • In cases of RPC errors, the responseVehicle field is cleared, and the errorResponse field is populated within jsonPayload, containing error details like status code and message.

  • Additional resources are available for understanding the logging query language and utilizing logs to create metrics, with links provided for further exploration.

Cloud Logging represents logs using the LogEntry data type, which defines common data for all log entries as well as the specific payloads that Google Cloud services can include. For details, see LogEntry.

Long logs are split into multiple log entries. See Handle split logs in this documentation.

Example log entries

The following example shows a LogEntry for the UpdateVehicle log. The RPC request and response are located inside the jsonPayload field.

    {
      "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"
    }

If an RPC error is returned, the responseVehicle field is cleared, and the errorResponse field is set and populated within 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"
    }

For more information about the logging query language, see Logging query language.

For information about how you can use your logs to create metrics, see Overview of logs-based metrics.

What's next

Handle long log entries with split logs.