# Google Cloud Logging API . projects . logs . entries

## Instance Methods

Creates one or more log entries in a log. You must supply a list of `LogEntry` objects, named `entries`. Each `LogEntry` object must contain a payload object and a `LogEntryMetadata` object that describes the entry. You must fill in all the fields of the entry, metadata, and payload. You can also supply a map, `commonLabels`, that supplies default (key, value) data for the `entries[].metadata.labels` maps, saving you the trouble of creating identical copies for each entry.

### Method Details

`write(projectsId, logsId, body, x__xgafv=None)`

    Creates one or more log entries in a log. You must supply a list of `LogEntry` objects, named `entries`. Each `LogEntry` object must contain a payload object and a `LogEntryMetadata` object that describes the entry. You must fill in all the fields of the entry, metadata, and payload. You can also supply a map, `commonLabels`, that supplies default (key, value) data for the `entries[].metadata.labels` maps, saving you the trouble of creating identical copies for each entry.

    Args:
      projectsId: string, Part of `logName`. The name of the log resource into which to insert the log entries. (required)
      logsId: string, Part of `logName`. See documentation of `projectsId`. (required)
      body: object, The request body. (required)
        The object takes the form of:

    { # The parameters to WriteLogEntries.
        "commonLabels": { # Metadata labels that apply to all entries in this request. If one of the log entries contains a (key, value) with the same key that is in `commonLabels`, then the entry's (key, value) overrides the one in `commonLabels`.
          "a_key": "A String",
        },
        "entries": [ # Log entries to insert.
          { # An individual entry in a log.
            "log": "A String", # The log to which this entry belongs. When a log entry is ingested, the value of this field is set by the logging system.
            "textPayload": "A String", # The log entry payload, represented as a text string.
            "structPayload": { # The log entry payload, represented as a structure that is expressed as a JSON object.
              "a_key": "", # Properties of the object.
            },
            "insertId": "A String", # A unique ID for the log entry. If you provide this field, the logging service considers other log entries in the same log with the same ID as duplicates which can be removed.
            "protoPayload": { # The log entry payload, represented as a protocol buffer that is expressed as a JSON object. You can only pass `protoPayload` values that belong to a set of approved types.
              "a_key": "", # Properties of the object. Contains field @ype with type URL.
            },
            "metadata": { # Additional data that is associated with a log entry, set by the service creating the log entry. # Information about the log entry.
              "severity": "A String", # The severity of the log entry.
              "zone": "A String", # The zone of the Google Cloud Platform service that created the log entry. For example, `"us-central1-a"`.
              "timestamp": "A String", # The time the event described by the log entry occurred. Timestamps must be later than January 1, 1970.
              "region": "A String", # The region name of the Google Cloud Platform service that created the log entry. For example, `"us-central1"`.
              "labels": { # A set of (key, value) data that provides additional information about the log entry. If the log entry is from one of the Google Cloud Platform sources listed below, the indicated (key, value) information must be provided: Google App Engine, service_name `appengine.googleapis.com`: "appengine.googleapis.com/module_id",  "appengine.googleapis.com/version_id",  and one of: "appengine.googleapis.com/replica_index",  "appengine.googleapis.com/clone_id",  or else provide the following Compute Engine labels: Google Compute Engine, service_name `compute.googleapis.com`: "compute.googleapis.com/resource_type", "instance" "compute.googleapis.com/resource_id",
                "a_key": "A String",
              },
              "userId": "A String", # The fully-qualified email address of the authenticated user that performed or requested the action represented by the log entry. If the log entry does not apply to an action taken by an authenticated user, then the field should be empty.
              "serviceName": "A String", # The API name of the Google Cloud Platform service that created the log entry. For example, `"compute.googleapis.com"`.
              "projectId": "A String", # The project ID of the Google Cloud Platform service that created the log entry.
            },
          },
        ],
      }

      x__xgafv: string, V1 error format.

    Returns:
      An object of the form:

        { # Result returned from WriteLogEntries. empty
      }