1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431
|
<html><body>
<style>
body, h1, h2, h3, div, span, p, pre, a {
margin: 0;
padding: 0;
border: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
body {
font-size: 13px;
padding: 1em;
}
h1 {
font-size: 26px;
margin-bottom: 1em;
}
h2 {
font-size: 24px;
margin-bottom: 1em;
}
h3 {
font-size: 20px;
margin-bottom: 1em;
margin-top: 1em;
}
pre, code {
line-height: 1.5;
font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
}
pre {
margin-top: 0.5em;
}
h1, h2, h3, p {
font-family: Arial, sans serif;
}
h1, h2, h3 {
border-bottom: solid #CCC 1px;
}
.toc_element {
margin-top: 0.5em;
}
.firstline {
margin-left: 2 em;
}
.method {
margin-top: 1em;
border: solid 1px #CCC;
padding: 1em;
background: #EEE;
}
.details {
font-weight: bold;
font-size: 14px;
}
</style>
<h1><a href="logging_v2.html">Stackdriver Logging API</a> . <a href="logging_v2.entries.html">entries</a></h1>
<h2>Instance Methods</h2>
<p class="toc_element">
<code><a href="#list">list(body, x__xgafv=None)</a></code></p>
<p class="firstline">Lists log entries. Use this method to retrieve log entries from Cloud</p>
<p class="toc_element">
<code><a href="#write">write(body, x__xgafv=None)</a></code></p>
<p class="firstline">Writes log entries to Stackdriver Logging. All log entries are</p>
<h3>Method Details</h3>
<div class="method">
<code class="details" id="list">list(body, x__xgafv=None)</code>
<pre>Lists log entries. Use this method to retrieve log entries from Cloud
Logging. For ways to export log entries, see
[Exporting Logs](/logging/docs/export).
Args:
body: object, The request body. (required)
The object takes the form of:
{ # The parameters to `ListLogEntries`.
"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`.
"resourceNames": [ # Required. One or more cloud resources from which to retrieve log entries.
# Example: `"projects/my-project-1A"`, `"projects/1234567890"`. Projects
# listed in `projectIds` are added to this list.
"A String",
],
"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.
"filter": "A String", # Optional. A filter that chooses which log entries to return. See [Advanced
# Logs Filters](/logging/docs/view/advanced_filters). Only log entries that
# match the filter are returned. An empty filter matches all log entries.
"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.
"projectIds": [ # Deprecated. One or more project identifiers or project numbers from which
# to retrieve log entries. Examples: `"my-project-1A"`, `"1234567890"`. If
# present, these project identifiers are converted to resource format and
# added to the list of resources in `resourceNames`. Callers should use
# `resourceNames` rather than this parameter.
"A String",
],
}
x__xgafv: string, V1 error format.
Allowed values
1 - v1 error format
2 - v2 error format
Returns:
An object of the form:
{ # Result returned from `ListLogEntries`.
"nextPageToken": "A String", # If there might be more results than appear 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`.
"entries": [ # A list of log entries.
{ # An individual entry in a log.
"httpRequest": { # A common proto for logging HTTP requests. Only contains semantics # Optional. Information about the HTTP request associated with this
# log entry, if applicable.
# defined by the HTTP specification. Product-specific logging
# information MUST be defined in a separate message.
"status": 42, # The response code indicating the status of response.
# Examples: 200, 404.
"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.
"requestMethod": "A String", # The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`.
"latency": "A String", # The request processing latency on the server, from the time the request was
# received until the response was sent.
"cacheFillBytes": "A String", # The number of HTTP response bytes inserted into cache. Set only when a
# cache fill was attempted.
"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"`.
"serverIp": "A String", # The IP address (IPv4 or IPv6) of the origin server that the request was
# sent to.
"cacheLookup": True or False, # Whether or not a cache lookup was attempted.
"cacheHit": True or False, # Whether or not an entity was served from cache
# (with or without validation).
"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).
"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"`.
"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)"`.
"requestSize": "A String", # The size of the HTTP request message in bytes, including the request
# headers and the request body.
"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.
},
"resource": { # An object representing a resource that can be used for monitoring, logging, # 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.
# 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"`:
#
# { "type": "gce_instance",
# "labels": { "instance_id": "12345678901234",
# "zone": "us-central1-a" }}
"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"`.
"a_key": "A String",
},
"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"`.
},
"severity": "A String", # Optional. The severity of the log entry. The default value is
# `LogSeverity.DEFAULT`.
"textPayload": "A String", # The log entry payload, represented as a Unicode string (UTF-8).
"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.
"labels": { # Optional. A set of user-defined (key, value) data that provides additional
# information about the log entry.
"a_key": "A String",
},
"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.
"jsonPayload": { # The log entry payload, represented as a structure that
# is expressed as a JSON object.
"a_key": "", # Properties of the object.
},
"logName": "A String", # Required. The resource name of the log to which this log entry
# belongs. The format of the name is
# `"projects/<project-id>/logs/<log-id>"`. Examples:
# `"projects/my-projectid/logs/syslog"`,
# `"projects/my-projectid/logs/library.googleapis.com%2Fbook_log"`.
#
# The log ID part of resource name must be less than 512 characters
# long and can only include the following characters: upper and
# lower case alphanumeric characters: [A-Za-z0-9]; and punctuation
# characters: forward-slash, underscore, hyphen, and period.
# Forward-slash (`/`) characters in the log ID must be URL-encoded.
"protoPayload": { # The log entry payload, represented as a protocol buffer. Some
# Google Cloud Platform services use this field for their log
# entry payloads.
"a_key": "", # Properties of the object. Contains field @type with type URL.
},
"operation": { # Additional information about a potentially long-running operation with which # Optional. Information about an operation associated with the log entry, if
# applicable.
# a log entry is associated.
"last": True or False, # Optional. Set this to True if this is the last log entry in the operation.
"id": "A String", # Optional. An arbitrary operation identifier. Log entries with the
# same identifier are assumed to be part of the same operation.
"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"`.
"first": True or False, # Optional. Set this to True if this is the first log entry in the operation.
},
},
],
}</pre>
</div>
<div class="method">
<code class="details" id="write">write(body, x__xgafv=None)</code>
<pre>Writes log entries to Stackdriver Logging. All log entries are
written by this method.
Args:
body: object, The request body. (required)
The object takes the form of:
{ # The parameters to WriteLogEntries.
"resource": { # An object representing a resource that can be used for monitoring, logging, # Optional. A default monitored resource object that is assigned to all log
# entries in `entries` that do not specify a value for `resource`. Example:
#
# { "type": "gce_instance",
# "labels": {
# "zone": "us-central1-a", "instance_id": "00000000000000000000" }}
#
# See LogEntry.
# 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"`:
#
# { "type": "gce_instance",
# "labels": { "instance_id": "12345678901234",
# "zone": "us-central1-a" }}
"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"`.
"a_key": "A String",
},
"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"`.
},
"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.
"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.
"a_key": "A String",
},
"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`. Example:
# `"projects/my-project/logs/syslog"`. See
# LogEntry.
"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](/logging/quota-policy) for calls to `entries.write`,
# you should write multiple log entries at once rather than
# calling this method for each individual log entry.
{ # An individual entry in a log.
"httpRequest": { # A common proto for logging HTTP requests. Only contains semantics # Optional. Information about the HTTP request associated with this
# log entry, if applicable.
# defined by the HTTP specification. Product-specific logging
# information MUST be defined in a separate message.
"status": 42, # The response code indicating the status of response.
# Examples: 200, 404.
"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.
"requestMethod": "A String", # The request method. Examples: `"GET"`, `"HEAD"`, `"PUT"`, `"POST"`.
"latency": "A String", # The request processing latency on the server, from the time the request was
# received until the response was sent.
"cacheFillBytes": "A String", # The number of HTTP response bytes inserted into cache. Set only when a
# cache fill was attempted.
"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"`.
"serverIp": "A String", # The IP address (IPv4 or IPv6) of the origin server that the request was
# sent to.
"cacheLookup": True or False, # Whether or not a cache lookup was attempted.
"cacheHit": True or False, # Whether or not an entity was served from cache
# (with or without validation).
"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).
"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"`.
"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)"`.
"requestSize": "A String", # The size of the HTTP request message in bytes, including the request
# headers and the request body.
"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.
},
"resource": { # An object representing a resource that can be used for monitoring, logging, # 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.
# 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"`:
#
# { "type": "gce_instance",
# "labels": { "instance_id": "12345678901234",
# "zone": "us-central1-a" }}
"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"`.
"a_key": "A String",
},
"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"`.
},
"severity": "A String", # Optional. The severity of the log entry. The default value is
# `LogSeverity.DEFAULT`.
"textPayload": "A String", # The log entry payload, represented as a Unicode string (UTF-8).
"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.
"labels": { # Optional. A set of user-defined (key, value) data that provides additional
# information about the log entry.
"a_key": "A String",
},
"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.
"jsonPayload": { # The log entry payload, represented as a structure that
# is expressed as a JSON object.
"a_key": "", # Properties of the object.
},
"logName": "A String", # Required. The resource name of the log to which this log entry
# belongs. The format of the name is
# `"projects/<project-id>/logs/<log-id>"`. Examples:
# `"projects/my-projectid/logs/syslog"`,
# `"projects/my-projectid/logs/library.googleapis.com%2Fbook_log"`.
#
# The log ID part of resource name must be less than 512 characters
# long and can only include the following characters: upper and
# lower case alphanumeric characters: [A-Za-z0-9]; and punctuation
# characters: forward-slash, underscore, hyphen, and period.
# Forward-slash (`/`) characters in the log ID must be URL-encoded.
"protoPayload": { # The log entry payload, represented as a protocol buffer. Some
# Google Cloud Platform services use this field for their log
# entry payloads.
"a_key": "", # Properties of the object. Contains field @type with type URL.
},
"operation": { # Additional information about a potentially long-running operation with which # Optional. Information about an operation associated with the log entry, if
# applicable.
# a log entry is associated.
"last": True or False, # Optional. Set this to True if this is the last log entry in the operation.
"id": "A String", # Optional. An arbitrary operation identifier. Log entries with the
# same identifier are assumed to be part of the same operation.
"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"`.
"first": True or False, # Optional. Set this to True if this is the first log entry in the operation.
},
},
],
}
x__xgafv: string, V1 error format.
Allowed values
1 - v1 error format
2 - v2 error format
Returns:
An object of the form:
{ # Result returned from WriteLogEntries.
# empty
}</pre>
</div>
</body></html>
|