• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5  margin: 0;
6  padding: 0;
7  border: 0;
8  font-weight: inherit;
9  font-style: inherit;
10  font-size: 100%;
11  font-family: inherit;
12  vertical-align: baseline;
13}
14
15body {
16  font-size: 13px;
17  padding: 1em;
18}
19
20h1 {
21  font-size: 26px;
22  margin-bottom: 1em;
23}
24
25h2 {
26  font-size: 24px;
27  margin-bottom: 1em;
28}
29
30h3 {
31  font-size: 20px;
32  margin-bottom: 1em;
33  margin-top: 1em;
34}
35
36pre, code {
37  line-height: 1.5;
38  font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42  margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46  font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50  border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54  margin-top: 0.5em;
55}
56
57.firstline {
58  margin-left: 2 em;
59}
60
61.method  {
62  margin-top: 1em;
63  border: solid 1px #CCC;
64  padding: 1em;
65  background: #EEE;
66}
67
68.details {
69  font-weight: bold;
70  font-size: 14px;
71}
72
73</style>
74
75<h1><a href="logging_v2.html">Stackdriver Logging API</a> . <a href="logging_v2.entries.html">entries</a></h1>
76<h2>Instance Methods</h2>
77<p class="toc_element">
78  <code><a href="#list">list(body, x__xgafv=None)</a></code></p>
79<p class="firstline">Lists log entries. Use this method to retrieve log entries from Stackdriver Logging. For ways to export log entries, see Exporting Logs.</p>
80<p class="toc_element">
81  <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p>
82<p class="firstline">Retrieves the next page of results.</p>
83<p class="toc_element">
84  <code><a href="#write">write(body, x__xgafv=None)</a></code></p>
85<p class="firstline">Writes log entries to Stackdriver Logging. All log entries are written by this method.</p>
86<h3>Method Details</h3>
87<div class="method">
88    <code class="details" id="list">list(body, x__xgafv=None)</code>
89  <pre>Lists log entries. Use this method to retrieve log entries from Stackdriver Logging. For ways to export log entries, see Exporting Logs.
90
91Args:
92  body: object, The request body. (required)
93    The object takes the form of:
94
95{ # The parameters to ListLogEntries.
96    "orderBy": "A String", # Optional. How the results should be sorted. Presently, the only permitted values are "timestamp asc" (default) and "timestamp desc". The first option returns entries in order of increasing values of LogEntry.timestamp (oldest first), and the second option returns entries in order of decreasing timestamps (newest first). Entries with equal timestamps are returned in order of LogEntry.insertId.
97    "resourceNames": [ # Required. Names of one or more resources from which to retrieve log entries:
98        # "projects/[PROJECT_ID]"
99        # "organizations/[ORGANIZATION_ID]"
100        # Projects listed in the project_ids field are added to this list.
101      "A String",
102    ],
103    "pageSize": 42, # Optional. The maximum number of results to return from this request. Non-positive values are ignored. The presence of nextPageToken in the response indicates that more results might be available.
104    "filter": "A String", # Optional. A filter that chooses which log entries to return. See Advanced Logs Filters. Only log entries that match the filter are returned. An empty filter matches all log entries in the resources listed in resource_names. Referencing a parent resource that is not listed in resource_names will cause the filter to return no results. The maximum length of the filter is 20000 characters.
105    "pageToken": "A String", # Optional. If present, then retrieve the next batch of results from the preceding call to this method. pageToken must be the value of nextPageToken from the previous response. The values of other method parameters should be identical to those in the previous call.
106    "projectIds": [ # Deprecated. Use resource_names instead. One or more project identifiers or project numbers from which to retrieve log entries. Example: "my-project-1A". If present, these project identifiers are converted to resource name format and added to the list of resources in resource_names.
107      "A String",
108    ],
109  }
110
111  x__xgafv: string, V1 error format.
112    Allowed values
113      1 - v1 error format
114      2 - v2 error format
115
116Returns:
117  An object of the form:
118
119    { # Result returned from ListLogEntries.
120    "nextPageToken": "A String", # If there might be more results than those appearing in this response, then nextPageToken is included. To get the next set of results, call this method again using the value of nextPageToken as pageToken.If a value for next_page_token appears and the entries field is empty, it means that the search found no log entries so far but it did not have time to search all the possible log entries. Retry the method with this value for page_token to continue the search. Alternatively, consider speeding up the search by changing your filter to specify a single log name or resource type, or to narrow the time range of the search.
121    "entries": [ # A list of log entries.
122      { # An individual entry in a log.
123        "httpRequest": { # A common proto for logging HTTP requests. Only contains semantics defined by the HTTP specification. Product-specific logging information MUST be defined in a separate message. # Optional. Information about the HTTP request associated with this log entry, if applicable.
124          "status": 42, # The response code indicating the status of response. Examples: 200, 404.
125          "cacheValidatedWithOriginServer": True or False, # Whether or not the response was validated with the origin server before being served from cache. This field is only meaningful if cache_hit is True.
126          "requestMethod": "A String", # The request method. Examples: "GET", "HEAD", "PUT", "POST".
127          "latency": "A String", # The request processing latency on the server, from the time the request was received until the response was sent.
128          "cacheFillBytes": "A String", # The number of HTTP response bytes inserted into cache. Set only when a cache fill was attempted.
129          "requestUrl": "A String", # The scheme (http, https), the host name, the path and the query portion of the URL that was requested. Example: "http://example.com/some/info?color=red".
130          "serverIp": "A String", # The IP address (IPv4 or IPv6) of the origin server that the request was sent to.
131          "cacheLookup": True or False, # Whether or not a cache lookup was attempted.
132          "cacheHit": True or False, # Whether or not an entity was served from cache (with or without validation).
133          "referer": "A String", # The referer URL of the request, as defined in HTTP/1.1 Header Field Definitions (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
134          "remoteIp": "A String", # The IP address (IPv4 or IPv6) of the client that issued the HTTP request. Examples: "192.168.1.1", "FE80::0202:B3FF:FE1E:8329".
135          "userAgent": "A String", # The user agent sent by the client. Example: "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)".
136          "requestSize": "A String", # The size of the HTTP request message in bytes, including the request headers and the request body.
137          "responseSize": "A String", # The size of the HTTP response message sent back to the client, in bytes, including the response headers and the response body.
138        },
139        "resource": { # An object representing a resource that can be used for monitoring, logging, billing, or other purposes. Examples include virtual machine instances, databases, and storage devices such as disks. The type field identifies a MonitoredResourceDescriptor object that describes the resource's schema. Information in the labels field identifies the actual resource and its attributes according to the schema. For example, a particular Compute Engine VM instance could be represented by the following object, because the MonitoredResourceDescriptor for "gce_instance" has labels "instance_id" and "zone": # Required. The monitored resource associated with this log entry. Example: a log entry that reports a database error would be associated with the monitored resource designating the particular database that reported the error.
140            # { "type": "gce_instance",
141            #   "labels": { "instance_id": "12345678901234",
142            #               "zone": "us-central1-a" }}
143          "labels": { # Required. Values for all of the labels listed in the associated monitored resource descriptor. For example, Cloud SQL databases use the labels "database_id" and "zone".
144            "a_key": "A String",
145          },
146          "type": "A String", # Required. The monitored resource type. This field must match the type field of a MonitoredResourceDescriptor object. For example, the type of a Cloud SQL database is "cloudsql_database".
147        },
148        "textPayload": "A String", # The log entry payload, represented as a Unicode string (UTF-8).
149        "trace": "A String", # Optional. Resource name of the trace associated with the log entry, if any. If it contains a relative resource name, the name is assumed to be relative to //tracing.googleapis.com. Example: projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824
150        "timestamp": "A String", # Optional. The time the event described by the log entry occurred. If omitted, Stackdriver Logging will use the time the log entry is received.
151        "labels": { # Optional. A set of user-defined (key, value) data that provides additional information about the log entry.
152          "a_key": "A String",
153        },
154        "insertId": "A String", # Optional. A unique ID for the log entry. If you provide this field, the logging service considers other log entries in the same project with the same ID as duplicates which can be removed. If omitted, Stackdriver Logging will generate a unique ID for this log entry.
155        "jsonPayload": { # The log entry payload, represented as a structure that is expressed as a JSON object.
156          "a_key": "", # Properties of the object.
157        },
158        "logName": "A String", # Required. The resource name of the log to which this log entry belongs:
159            # "projects/[PROJECT_ID]/logs/[LOG_ID]"
160            # "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
161            # [LOG_ID] must be URL-encoded within log_name. Example: "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". [LOG_ID] must be less than 512 characters long and can only include the following characters: upper and lower case alphanumeric characters, forward-slash, underscore, hyphen, and period.For backward compatibility, if log_name begins with a forward-slash, such as /projects/..., then the log entry is ingested as usual but the forward-slash is removed. Listing the log entry will not show the leading slash and filtering for a log name with a leading slash will never return any results.
162        "protoPayload": { # The log entry payload, represented as a protocol buffer. Some Google Cloud Platform services use this field for their log entry payloads.
163          "a_key": "", # Properties of the object. Contains field @type with type URL.
164        },
165        "operation": { # Additional information about a potentially long-running operation with which a log entry is associated. # Optional. Information about an operation associated with the log entry, if applicable.
166          "last": True or False, # Optional. Set this to True if this is the last log entry in the operation.
167          "id": "A String", # Optional. An arbitrary operation identifier. Log entries with the same identifier are assumed to be part of the same operation.
168          "producer": "A String", # Optional. An arbitrary producer identifier. The combination of id and producer must be globally unique. Examples for producer: "MyDivision.MyBigCompany.com", "github.com/MyProject/MyApplication".
169          "first": True or False, # Optional. Set this to True if this is the first log entry in the operation.
170        },
171        "sourceLocation": { # Additional information about the source code location that produced the log entry. # Optional. Source code location information associated with the log entry, if any.
172          "function": "A String", # Optional. Human-readable name of the function or method being invoked, with optional context such as the class or package name. This information may be used in contexts such as the logs viewer, where a file and line number are less meaningful. The format can vary by language. For example: qual.if.ied.Class.method (Java), dir/package.func (Go), function (Python).
173          "line": "A String", # Optional. Line within the source file. 1-based; 0 indicates no line number available.
174          "file": "A String", # Optional. Source file name. Depending on the runtime environment, this might be a simple name or a fully-qualified name.
175        },
176        "severity": "A String", # Optional. The severity of the log entry. The default value is LogSeverity.DEFAULT.
177      },
178    ],
179  }</pre>
180</div>
181
182<div class="method">
183    <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
184  <pre>Retrieves the next page of results.
185
186Args:
187  previous_request: The request for the previous page. (required)
188  previous_response: The response from the request for the previous page. (required)
189
190Returns:
191  A request object that you can call 'execute()' on to request the next
192  page. Returns None if there are no more items in the collection.
193    </pre>
194</div>
195
196<div class="method">
197    <code class="details" id="write">write(body, x__xgafv=None)</code>
198  <pre>Writes log entries to Stackdriver Logging. All log entries are written by this method.
199
200Args:
201  body: object, The request body. (required)
202    The object takes the form of:
203
204{ # The parameters to WriteLogEntries.
205    "resource": { # An object representing a resource that can be used for monitoring, logging, billing, or other purposes. Examples include virtual machine instances, databases, and storage devices such as disks. The type field identifies a MonitoredResourceDescriptor object that describes the resource's schema. Information in the labels field identifies the actual resource and its attributes according to the schema. For example, a particular Compute Engine VM instance could be represented by the following object, because the MonitoredResourceDescriptor for "gce_instance" has labels "instance_id" and "zone": # Optional. A default monitored resource object that is assigned to all log entries in entries that do not specify a value for resource. Example:
206        # { "type": "gce_instance",
207        #   "labels": {
208        #     "zone": "us-central1-a", "instance_id": "00000000000000000000" }}
209        # See LogEntry.
210        # { "type": "gce_instance",
211        #   "labels": { "instance_id": "12345678901234",
212        #               "zone": "us-central1-a" }}
213      "labels": { # Required. Values for all of the labels listed in the associated monitored resource descriptor. For example, Cloud SQL databases use the labels "database_id" and "zone".
214        "a_key": "A String",
215      },
216      "type": "A String", # Required. The monitored resource type. This field must match the type field of a MonitoredResourceDescriptor object. For example, the type of a Cloud SQL database is "cloudsql_database".
217    },
218    "partialSuccess": True or False, # Optional. Whether valid entries should be written even if some other entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors. If any entry is not written, the response status will be the error associated with one of the failed entries and include error details in the form of WriteLogEntriesPartialErrors.
219    "labels": { # Optional. Default labels that are added to the labels field of all log entries in entries. If a log entry already has a label with the same key as a label in this parameter, then the log entry's label is not changed. See LogEntry.
220      "a_key": "A String",
221    },
222    "logName": "A String", # Optional. A default log resource name that is assigned to all log entries in entries that do not specify a value for log_name:
223        # "projects/[PROJECT_ID]/logs/[LOG_ID]"
224        # "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
225        # [LOG_ID] must be URL-encoded. For example, "projects/my-project-id/logs/syslog" or "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". For more information about log names, see LogEntry.
226    "entries": [ # Required. The log entries to write. Values supplied for the fields log_name, resource, and labels in this entries.write request are added to those log entries that do not provide their own values for the fields.To improve throughput and to avoid exceeding the quota limit for calls to entries.write, you should write multiple log entries at once rather than calling this method for each individual log entry.
227      { # An individual entry in a log.
228        "httpRequest": { # A common proto for logging HTTP requests. Only contains semantics defined by the HTTP specification. Product-specific logging information MUST be defined in a separate message. # Optional. Information about the HTTP request associated with this log entry, if applicable.
229          "status": 42, # The response code indicating the status of response. Examples: 200, 404.
230          "cacheValidatedWithOriginServer": True or False, # Whether or not the response was validated with the origin server before being served from cache. This field is only meaningful if cache_hit is True.
231          "requestMethod": "A String", # The request method. Examples: "GET", "HEAD", "PUT", "POST".
232          "latency": "A String", # The request processing latency on the server, from the time the request was received until the response was sent.
233          "cacheFillBytes": "A String", # The number of HTTP response bytes inserted into cache. Set only when a cache fill was attempted.
234          "requestUrl": "A String", # The scheme (http, https), the host name, the path and the query portion of the URL that was requested. Example: "http://example.com/some/info?color=red".
235          "serverIp": "A String", # The IP address (IPv4 or IPv6) of the origin server that the request was sent to.
236          "cacheLookup": True or False, # Whether or not a cache lookup was attempted.
237          "cacheHit": True or False, # Whether or not an entity was served from cache (with or without validation).
238          "referer": "A String", # The referer URL of the request, as defined in HTTP/1.1 Header Field Definitions (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html).
239          "remoteIp": "A String", # The IP address (IPv4 or IPv6) of the client that issued the HTTP request. Examples: "192.168.1.1", "FE80::0202:B3FF:FE1E:8329".
240          "userAgent": "A String", # The user agent sent by the client. Example: "Mozilla/4.0 (compatible; MSIE 6.0; Windows 98; Q312461; .NET CLR 1.0.3705)".
241          "requestSize": "A String", # The size of the HTTP request message in bytes, including the request headers and the request body.
242          "responseSize": "A String", # The size of the HTTP response message sent back to the client, in bytes, including the response headers and the response body.
243        },
244        "resource": { # An object representing a resource that can be used for monitoring, logging, billing, or other purposes. Examples include virtual machine instances, databases, and storage devices such as disks. The type field identifies a MonitoredResourceDescriptor object that describes the resource's schema. Information in the labels field identifies the actual resource and its attributes according to the schema. For example, a particular Compute Engine VM instance could be represented by the following object, because the MonitoredResourceDescriptor for "gce_instance" has labels "instance_id" and "zone": # Required. The monitored resource associated with this log entry. Example: a log entry that reports a database error would be associated with the monitored resource designating the particular database that reported the error.
245            # { "type": "gce_instance",
246            #   "labels": { "instance_id": "12345678901234",
247            #               "zone": "us-central1-a" }}
248          "labels": { # Required. Values for all of the labels listed in the associated monitored resource descriptor. For example, Cloud SQL databases use the labels "database_id" and "zone".
249            "a_key": "A String",
250          },
251          "type": "A String", # Required. The monitored resource type. This field must match the type field of a MonitoredResourceDescriptor object. For example, the type of a Cloud SQL database is "cloudsql_database".
252        },
253        "textPayload": "A String", # The log entry payload, represented as a Unicode string (UTF-8).
254        "trace": "A String", # Optional. Resource name of the trace associated with the log entry, if any. If it contains a relative resource name, the name is assumed to be relative to //tracing.googleapis.com. Example: projects/my-projectid/traces/06796866738c859f2f19b7cfb3214824
255        "timestamp": "A String", # Optional. The time the event described by the log entry occurred. If omitted, Stackdriver Logging will use the time the log entry is received.
256        "labels": { # Optional. A set of user-defined (key, value) data that provides additional information about the log entry.
257          "a_key": "A String",
258        },
259        "insertId": "A String", # Optional. A unique ID for the log entry. If you provide this field, the logging service considers other log entries in the same project with the same ID as duplicates which can be removed. If omitted, Stackdriver Logging will generate a unique ID for this log entry.
260        "jsonPayload": { # The log entry payload, represented as a structure that is expressed as a JSON object.
261          "a_key": "", # Properties of the object.
262        },
263        "logName": "A String", # Required. The resource name of the log to which this log entry belongs:
264            # "projects/[PROJECT_ID]/logs/[LOG_ID]"
265            # "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
266            # [LOG_ID] must be URL-encoded within log_name. Example: "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity". [LOG_ID] must be less than 512 characters long and can only include the following characters: upper and lower case alphanumeric characters, forward-slash, underscore, hyphen, and period.For backward compatibility, if log_name begins with a forward-slash, such as /projects/..., then the log entry is ingested as usual but the forward-slash is removed. Listing the log entry will not show the leading slash and filtering for a log name with a leading slash will never return any results.
267        "protoPayload": { # The log entry payload, represented as a protocol buffer. Some Google Cloud Platform services use this field for their log entry payloads.
268          "a_key": "", # Properties of the object. Contains field @type with type URL.
269        },
270        "operation": { # Additional information about a potentially long-running operation with which a log entry is associated. # Optional. Information about an operation associated with the log entry, if applicable.
271          "last": True or False, # Optional. Set this to True if this is the last log entry in the operation.
272          "id": "A String", # Optional. An arbitrary operation identifier. Log entries with the same identifier are assumed to be part of the same operation.
273          "producer": "A String", # Optional. An arbitrary producer identifier. The combination of id and producer must be globally unique. Examples for producer: "MyDivision.MyBigCompany.com", "github.com/MyProject/MyApplication".
274          "first": True or False, # Optional. Set this to True if this is the first log entry in the operation.
275        },
276        "sourceLocation": { # Additional information about the source code location that produced the log entry. # Optional. Source code location information associated with the log entry, if any.
277          "function": "A String", # Optional. Human-readable name of the function or method being invoked, with optional context such as the class or package name. This information may be used in contexts such as the logs viewer, where a file and line number are less meaningful. The format can vary by language. For example: qual.if.ied.Class.method (Java), dir/package.func (Go), function (Python).
278          "line": "A String", # Optional. Line within the source file. 1-based; 0 indicates no line number available.
279          "file": "A String", # Optional. Source file name. Depending on the runtime environment, this might be a simple name or a fully-qualified name.
280        },
281        "severity": "A String", # Optional. The severity of the log entry. The default value is LogSeverity.DEFAULT.
282      },
283    ],
284  }
285
286  x__xgafv: string, V1 error format.
287    Allowed values
288      1 - v1 error format
289      2 - v2 error format
290
291Returns:
292  An object of the form:
293
294    { # Result returned from WriteLogEntries. empty
295  }</pre>
296</div>
297
298</body></html>