google-cloud-logging 1.10.4 → 1.10.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -0
- data/TROUBLESHOOTING.md +2 -8
- data/lib/google/cloud/logging/async_writer.rb +17 -9
- data/lib/google/cloud/logging/v2/config_service_v2_client.rb +191 -191
- data/lib/google/cloud/logging/v2/config_service_v2_client_config.json +26 -21
- data/lib/google/cloud/logging/v2/doc/google/api/metric.rb +49 -7
- data/lib/google/cloud/logging/v2/doc/google/api/monitored_resource.rb +40 -7
- data/lib/google/cloud/logging/v2/logging_service_v2_client.rb +121 -121
- data/lib/google/cloud/logging/v2/logging_service_v2_client_config.json +19 -14
- data/lib/google/cloud/logging/v2/metrics_service_v2_client.rb +93 -93
- data/lib/google/cloud/logging/v2/metrics_service_v2_client_config.json +13 -8
- data/lib/google/cloud/logging/version.rb +1 -1
- data/lib/google/logging/v2/log_entry_pb.rb +5 -5
- data/lib/google/logging/v2/logging_config_pb.rb +27 -27
- data/lib/google/logging/v2/logging_config_services_pb.rb +83 -83
- data/lib/google/logging/v2/logging_metrics_pb.rb +10 -10
- data/lib/google/logging/v2/logging_metrics_services_pb.rb +23 -23
- data/lib/google/logging/v2/logging_pb.rb +12 -12
- data/lib/google/logging/v2/logging_services_pb.rb +35 -35
- metadata +5 -5
@@ -4,9 +4,14 @@
|
|
4
4
|
"retry_codes": {
|
5
5
|
"idempotent": [
|
6
6
|
"DEADLINE_EXCEEDED",
|
7
|
+
"INTERNAL",
|
7
8
|
"UNAVAILABLE"
|
8
9
|
],
|
9
|
-
"non_idempotent": []
|
10
|
+
"non_idempotent": [],
|
11
|
+
"idempotent2": [
|
12
|
+
"DEADLINE_EXCEEDED",
|
13
|
+
"UNAVAILABLE"
|
14
|
+
]
|
10
15
|
},
|
11
16
|
"retry_params": {
|
12
17
|
"default": {
|
@@ -20,54 +25,59 @@
|
|
20
25
|
}
|
21
26
|
},
|
22
27
|
"methods": {
|
23
|
-
"
|
28
|
+
"DeleteSink": {
|
24
29
|
"timeout_millis": 60000,
|
25
30
|
"retry_codes_name": "idempotent",
|
26
31
|
"retry_params_name": "default"
|
27
32
|
},
|
28
|
-
"
|
33
|
+
"UpdateSink": {
|
29
34
|
"timeout_millis": 60000,
|
30
35
|
"retry_codes_name": "idempotent",
|
31
36
|
"retry_params_name": "default"
|
32
37
|
},
|
33
|
-
"
|
38
|
+
"DeleteExclusion": {
|
34
39
|
"timeout_millis": 60000,
|
35
|
-
"retry_codes_name": "
|
40
|
+
"retry_codes_name": "idempotent",
|
36
41
|
"retry_params_name": "default"
|
37
42
|
},
|
38
|
-
"
|
43
|
+
"ListBuckets": {
|
39
44
|
"timeout_millis": 60000,
|
40
|
-
"retry_codes_name": "
|
45
|
+
"retry_codes_name": "idempotent2",
|
41
46
|
"retry_params_name": "default"
|
42
47
|
},
|
43
|
-
"
|
48
|
+
"GetBucket": {
|
44
49
|
"timeout_millis": 60000,
|
45
|
-
"retry_codes_name": "
|
50
|
+
"retry_codes_name": "idempotent2",
|
46
51
|
"retry_params_name": "default"
|
47
52
|
},
|
48
|
-
"
|
53
|
+
"UpdateBucket": {
|
49
54
|
"timeout_millis": 60000,
|
50
55
|
"retry_codes_name": "non_idempotent",
|
51
56
|
"retry_params_name": "default"
|
52
57
|
},
|
53
|
-
"
|
58
|
+
"ListSinks": {
|
54
59
|
"timeout_millis": 60000,
|
55
|
-
"retry_codes_name": "
|
60
|
+
"retry_codes_name": "idempotent2",
|
56
61
|
"retry_params_name": "default"
|
57
62
|
},
|
58
|
-
"
|
63
|
+
"GetSink": {
|
64
|
+
"timeout_millis": 60000,
|
65
|
+
"retry_codes_name": "idempotent2",
|
66
|
+
"retry_params_name": "default"
|
67
|
+
},
|
68
|
+
"CreateSink": {
|
59
69
|
"timeout_millis": 60000,
|
60
70
|
"retry_codes_name": "non_idempotent",
|
61
71
|
"retry_params_name": "default"
|
62
72
|
},
|
63
73
|
"ListExclusions": {
|
64
74
|
"timeout_millis": 60000,
|
65
|
-
"retry_codes_name": "
|
75
|
+
"retry_codes_name": "idempotent2",
|
66
76
|
"retry_params_name": "default"
|
67
77
|
},
|
68
78
|
"GetExclusion": {
|
69
79
|
"timeout_millis": 60000,
|
70
|
-
"retry_codes_name": "
|
80
|
+
"retry_codes_name": "idempotent2",
|
71
81
|
"retry_params_name": "default"
|
72
82
|
},
|
73
83
|
"CreateExclusion": {
|
@@ -80,14 +90,9 @@
|
|
80
90
|
"retry_codes_name": "non_idempotent",
|
81
91
|
"retry_params_name": "default"
|
82
92
|
},
|
83
|
-
"DeleteExclusion": {
|
84
|
-
"timeout_millis": 60000,
|
85
|
-
"retry_codes_name": "non_idempotent",
|
86
|
-
"retry_params_name": "default"
|
87
|
-
},
|
88
93
|
"GetCmekSettings": {
|
89
94
|
"timeout_millis": 60000,
|
90
|
-
"retry_codes_name": "
|
95
|
+
"retry_codes_name": "idempotent2",
|
91
96
|
"retry_params_name": "default"
|
92
97
|
},
|
93
98
|
"UpdateCmekSettings": {
|
@@ -18,15 +18,41 @@ module Google
|
|
18
18
|
# Defines a metric type and its schema. Once a metric descriptor is created,
|
19
19
|
# deleting or altering it stops data collection and makes the metric type's
|
20
20
|
# existing data unusable.
|
21
|
+
#
|
22
|
+
# The following are specific rules for service defined Monitoring metric
|
23
|
+
# descriptors:
|
24
|
+
#
|
25
|
+
# * `type`, `metric_kind`, `value_type`, `description`, `display_name`,
|
26
|
+
# `launch_stage` fields are all required. The `unit` field must be specified
|
27
|
+
# if the `value_type` is any of DOUBLE, INT64, DISTRIBUTION.
|
28
|
+
# * Maximum of default 500 metric descriptors per service is allowed.
|
29
|
+
# * Maximum of default 10 labels per metric descriptor is allowed.
|
30
|
+
#
|
31
|
+
# The default maximum limit can be overridden. Please follow
|
32
|
+
# https://cloud.google.com/monitoring/quotas
|
21
33
|
# @!attribute [rw] name
|
22
34
|
# @return [String]
|
23
35
|
# The resource name of the metric descriptor.
|
24
36
|
# @!attribute [rw] type
|
25
37
|
# @return [String]
|
26
38
|
# The metric type, including its DNS name prefix. The type is not
|
27
|
-
# URL-encoded.
|
28
|
-
#
|
29
|
-
#
|
39
|
+
# URL-encoded.
|
40
|
+
#
|
41
|
+
# All service defined metrics must be prefixed with the service name, in the
|
42
|
+
# format of `{service name}/{relative metric name}`, such as
|
43
|
+
# `cloudsql.googleapis.com/database/cpu/utilization`. The relative metric
|
44
|
+
# name must follow:
|
45
|
+
#
|
46
|
+
# * Only upper and lower-case letters, digits, '/' and underscores '_' are
|
47
|
+
# allowed.
|
48
|
+
# * The maximum number of characters allowed for the relative_metric_name is
|
49
|
+
# 100.
|
50
|
+
#
|
51
|
+
# All user-defined metric types have the DNS name
|
52
|
+
# `custom.googleapis.com`, `external.googleapis.com`, or
|
53
|
+
# `logging.googleapis.com/user/`.
|
54
|
+
#
|
55
|
+
# Metric types should use a natural hierarchical grouping. For example:
|
30
56
|
#
|
31
57
|
# "custom.googleapis.com/invoice/paid/amount"
|
32
58
|
# "external.googleapis.com/prometheus/up"
|
@@ -34,7 +60,16 @@ module Google
|
|
34
60
|
# @!attribute [rw] labels
|
35
61
|
# @return [Array<Google::Api::LabelDescriptor>]
|
36
62
|
# The set of labels that can be used to describe a specific
|
37
|
-
# instance of this metric type.
|
63
|
+
# instance of this metric type.
|
64
|
+
#
|
65
|
+
# The label key name must follow:
|
66
|
+
#
|
67
|
+
# * Only upper and lower-case letters, digits and underscores (_) are
|
68
|
+
# allowed.
|
69
|
+
# * Label name must start with a letter or digit.
|
70
|
+
# * The maximum length of a label name is 100 characters.
|
71
|
+
#
|
72
|
+
# For example, the
|
38
73
|
# `appengine.googleapis.com/http/server/response_latencies` metric
|
39
74
|
# type has a label for the HTTP response code, `response_code`, so
|
40
75
|
# you can look at latencies for successful responses or just
|
@@ -64,7 +99,7 @@ module Google
|
|
64
99
|
# `s{CPU}` (or equivalently `1s{CPU}` or just `s`). If the job uses 12,005
|
65
100
|
# CPU-seconds, then the value is written as `12005`.
|
66
101
|
#
|
67
|
-
# Alternatively, if you want a
|
102
|
+
# Alternatively, if you want a custom metric to record data in a more
|
68
103
|
# granular way, you can create a `DOUBLE CUMULATIVE` metric whose `unit` is
|
69
104
|
# `ks{CPU}`, and then write the value `12.005` (which is `12005/1000`),
|
70
105
|
# or use `Kis{CPU}` and write `11.723` (which is `12005/1024`).
|
@@ -80,6 +115,7 @@ module Google
|
|
80
115
|
# * `min` minute
|
81
116
|
# * `h` hour
|
82
117
|
# * `d` day
|
118
|
+
# * `1` dimensionless
|
83
119
|
#
|
84
120
|
# **Prefixes (PREFIX)**
|
85
121
|
#
|
@@ -165,12 +201,18 @@ module Google
|
|
165
201
|
# @!attribute [rw] launch_stage
|
166
202
|
# @return [Google::Api::LaunchStage]
|
167
203
|
# Optional. The launch stage of the metric definition.
|
204
|
+
# @!attribute [rw] monitored_resource_types
|
205
|
+
# @return [Array<String>]
|
206
|
+
# Read-only. If present, then a [time
|
207
|
+
# series][google.monitoring.v3.TimeSeries], which is identified partially by
|
208
|
+
# a metric type and a {Google::Api::MonitoredResourceDescriptor MonitoredResourceDescriptor}, that is associated
|
209
|
+
# with this metric type can only be associated with one of the monitored
|
210
|
+
# resource types listed here.
|
168
211
|
class MetricDescriptor
|
169
212
|
# Additional annotations that can be used to guide the usage of a metric.
|
170
213
|
# @!attribute [rw] launch_stage
|
171
214
|
# @return [Google::Api::LaunchStage]
|
172
|
-
# Deprecated.
|
173
|
-
# The launch stage of the metric definition.
|
215
|
+
# Deprecated. Must use the {Google::Api::MetricDescriptor#launch_stage MetricDescriptor#launch_stage} instead.
|
174
216
|
# @!attribute [rw] sample_period
|
175
217
|
# @return [Google::Protobuf::Duration]
|
176
218
|
# The sampling period of metric data points. For metrics which are written
|
@@ -21,9 +21,23 @@ module Google
|
|
21
21
|
# `"gce_instance"` and specifies the use of the labels `"instance_id"` and
|
22
22
|
# `"zone"` to identify particular VM instances.
|
23
23
|
#
|
24
|
-
# Different
|
25
|
-
#
|
26
|
-
#
|
24
|
+
# Different services can support different monitored resource types.
|
25
|
+
#
|
26
|
+
# The following are specific rules to service defined monitored resources for
|
27
|
+
# Monitoring and Logging:
|
28
|
+
#
|
29
|
+
# * The `type`, `display_name`, `description`, `labels` and `launch_stage`
|
30
|
+
# fields are all required.
|
31
|
+
# * The first label of the monitored resource descriptor must be
|
32
|
+
# `resource_container`. There are legacy monitored resource descritptors
|
33
|
+
# start with `project_id`.
|
34
|
+
# * It must include a `location` label.
|
35
|
+
# * Maximum of default 5 service defined monitored resource descriptors
|
36
|
+
# is allowed per service.
|
37
|
+
# * Maximum of default 10 labels per monitored resource is allowed.
|
38
|
+
#
|
39
|
+
# The default maximum limit can be overridden. Please follow
|
40
|
+
# https://cloud.google.com/monitoring/quotas
|
27
41
|
# @!attribute [rw] name
|
28
42
|
# @return [String]
|
29
43
|
# Optional. The resource name of the monitored resource descriptor:
|
@@ -35,8 +49,19 @@ module Google
|
|
35
49
|
# @!attribute [rw] type
|
36
50
|
# @return [String]
|
37
51
|
# Required. The monitored resource type. For example, the type
|
38
|
-
# `
|
39
|
-
#
|
52
|
+
# `cloudsql_database` represents databases in Google Cloud SQL.
|
53
|
+
#
|
54
|
+
# All service defined monitored resource types must be prefixed with the
|
55
|
+
# service name, in the format of `{service name}/{relative resource name}`.
|
56
|
+
# The relative resource name must follow:
|
57
|
+
#
|
58
|
+
# * Only upper and lower-case letters and digits are allowed.
|
59
|
+
# * It must start with upper case character and is recommended to use Upper
|
60
|
+
# Camel Case style.
|
61
|
+
# * The maximum number of characters allowed for the relative_resource_name
|
62
|
+
# is 100.
|
63
|
+
#
|
64
|
+
# Note there are legacy service monitored resources not following this rule.
|
40
65
|
# @!attribute [rw] display_name
|
41
66
|
# @return [String]
|
42
67
|
# Optional. A concise name for the monitored resource type that might be
|
@@ -50,8 +75,16 @@ module Google
|
|
50
75
|
# @!attribute [rw] labels
|
51
76
|
# @return [Array<Google::Api::LabelDescriptor>]
|
52
77
|
# Required. A set of labels used to describe instances of this monitored
|
53
|
-
# resource type.
|
54
|
-
#
|
78
|
+
# resource type.
|
79
|
+
# The label key name must follow:
|
80
|
+
#
|
81
|
+
# * Only upper and lower-case letters, digits and underscores (_) are
|
82
|
+
# allowed.
|
83
|
+
# * Label name must start with a letter or digit.
|
84
|
+
# * The maximum length of a label name is 100 characters.
|
85
|
+
#
|
86
|
+
# For example, an individual Google Cloud SQL database is
|
87
|
+
# identified by values for the labels `database_id` and `location`.
|
55
88
|
# @!attribute [rw] launch_stage
|
56
89
|
# @return [Google::Api::LaunchStage]
|
57
90
|
# Optional. The launch stage of the monitored resource definition.
|
@@ -282,11 +282,6 @@ module Google
|
|
282
282
|
&Google::Logging::V2::LoggingServiceV2::Stub.method(:new)
|
283
283
|
)
|
284
284
|
|
285
|
-
@write_log_entries = Google::Gax.create_api_call(
|
286
|
-
@logging_service_v2_stub.method(:write_log_entries),
|
287
|
-
defaults["write_log_entries"],
|
288
|
-
exception_transformer: exception_transformer
|
289
|
-
)
|
290
285
|
@delete_log = Google::Gax.create_api_call(
|
291
286
|
@logging_service_v2_stub.method(:delete_log),
|
292
287
|
defaults["delete_log"],
|
@@ -300,6 +295,11 @@ module Google
|
|
300
295
|
defaults["list_log_entries"],
|
301
296
|
exception_transformer: exception_transformer
|
302
297
|
)
|
298
|
+
@write_log_entries = Google::Gax.create_api_call(
|
299
|
+
@logging_service_v2_stub.method(:write_log_entries),
|
300
|
+
defaults["write_log_entries"],
|
301
|
+
exception_transformer: exception_transformer
|
302
|
+
)
|
303
303
|
@list_monitored_resource_descriptors = Google::Gax.create_api_call(
|
304
304
|
@logging_service_v2_stub.method(:list_monitored_resource_descriptors),
|
305
305
|
defaults["list_monitored_resource_descriptors"],
|
@@ -317,122 +317,6 @@ module Google
|
|
317
317
|
|
318
318
|
# Service calls
|
319
319
|
|
320
|
-
# Writes log entries to Logging. This API method is the
|
321
|
-
# only way to send log entries to Logging. This method
|
322
|
-
# is used, directly or indirectly, by the Logging agent
|
323
|
-
# (fluentd) and all logging libraries configured to use Logging.
|
324
|
-
# A single request may contain log entries for a maximum of 1000
|
325
|
-
# different resources (projects, organizations, billing accounts or
|
326
|
-
# folders)
|
327
|
-
#
|
328
|
-
# @param entries [Array<Google::Logging::V2::LogEntry | Hash>]
|
329
|
-
# Required. The log entries to send to Logging. The order of log
|
330
|
-
# entries in this list does not matter. Values supplied in this method's
|
331
|
-
# `log_name`, `resource`, and `labels` fields are copied into those log
|
332
|
-
# entries in this list that do not include values for their corresponding
|
333
|
-
# fields. For more information, see the
|
334
|
-
# {Google::Logging::V2::LogEntry LogEntry} type.
|
335
|
-
#
|
336
|
-
# If the `timestamp` or `insert_id` fields are missing in log entries, then
|
337
|
-
# this method supplies the current time or a unique identifier, respectively.
|
338
|
-
# The supplied values are chosen so that, among the log entries that did not
|
339
|
-
# supply their own values, the entries earlier in the list will sort before
|
340
|
-
# the entries later in the list. See the `entries.list` method.
|
341
|
-
#
|
342
|
-
# Log entries with timestamps that are more than the
|
343
|
-
# [logs retention period](https://cloud.google.com/logging/quota-policy) in the past or more than
|
344
|
-
# 24 hours in the future will not be available when calling `entries.list`.
|
345
|
-
# However, those log entries can still be
|
346
|
-
# [exported with LogSinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs).
|
347
|
-
#
|
348
|
-
# To improve throughput and to avoid exceeding the
|
349
|
-
# [quota limit](https://cloud.google.com/logging/quota-policy) for calls to `entries.write`,
|
350
|
-
# you should try to include several log entries in this list,
|
351
|
-
# rather than calling this method for each individual log entry.
|
352
|
-
# A hash of the same form as `Google::Logging::V2::LogEntry`
|
353
|
-
# can also be provided.
|
354
|
-
# @param log_name [String]
|
355
|
-
# Optional. A default log resource name that is assigned to all log entries
|
356
|
-
# in `entries` that do not specify a value for `log_name`:
|
357
|
-
#
|
358
|
-
# "projects/[PROJECT_ID]/logs/[LOG_ID]"
|
359
|
-
# "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
|
360
|
-
# "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]"
|
361
|
-
# "folders/[FOLDER_ID]/logs/[LOG_ID]"
|
362
|
-
#
|
363
|
-
# `[LOG_ID]` must be URL-encoded. For example:
|
364
|
-
#
|
365
|
-
# "projects/my-project-id/logs/syslog"
|
366
|
-
# "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"
|
367
|
-
#
|
368
|
-
# The permission `logging.logEntries.create` is needed on each project,
|
369
|
-
# organization, billing account, or folder that is receiving new log
|
370
|
-
# entries, whether the resource is specified in `logName` or in an
|
371
|
-
# individual log entry.
|
372
|
-
# @param resource [Google::Api::MonitoredResource | Hash]
|
373
|
-
# Optional. A default monitored resource object that is assigned to all log
|
374
|
-
# entries in `entries` that do not specify a value for `resource`. Example:
|
375
|
-
#
|
376
|
-
# { "type": "gce_instance",
|
377
|
-
# "labels": {
|
378
|
-
# "zone": "us-central1-a", "instance_id": "00000000000000000000" }}
|
379
|
-
#
|
380
|
-
# See {Google::Logging::V2::LogEntry LogEntry}.
|
381
|
-
# A hash of the same form as `Google::Api::MonitoredResource`
|
382
|
-
# can also be provided.
|
383
|
-
# @param labels [Hash{String => String}]
|
384
|
-
# Optional. Default labels that are added to the `labels` field of all log
|
385
|
-
# entries in `entries`. If a log entry already has a label with the same key
|
386
|
-
# as a label in this parameter, then the log entry's label is not changed.
|
387
|
-
# See {Google::Logging::V2::LogEntry LogEntry}.
|
388
|
-
# @param partial_success [true, false]
|
389
|
-
# Optional. Whether valid entries should be written even if some other
|
390
|
-
# entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors. If any
|
391
|
-
# entry is not written, then the response status is the error associated
|
392
|
-
# with one of the failed entries and the response includes error details
|
393
|
-
# keyed by the entries' zero-based index in the `entries.write` method.
|
394
|
-
# @param dry_run [true, false]
|
395
|
-
# Optional. If true, the request should expect normal response, but the
|
396
|
-
# entries won't be persisted nor exported. Useful for checking whether the
|
397
|
-
# logging API endpoints are working properly before sending valuable data.
|
398
|
-
# @param options [Google::Gax::CallOptions]
|
399
|
-
# Overrides the default settings for this call, e.g, timeout,
|
400
|
-
# retries, etc.
|
401
|
-
# @yield [result, operation] Access the result along with the RPC operation
|
402
|
-
# @yieldparam result [Google::Logging::V2::WriteLogEntriesResponse]
|
403
|
-
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
404
|
-
# @return [Google::Logging::V2::WriteLogEntriesResponse]
|
405
|
-
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
406
|
-
# @example
|
407
|
-
# require "google/cloud/logging/v2"
|
408
|
-
#
|
409
|
-
# logging_client = Google::Cloud::Logging::V2::LoggingServiceV2Client.new
|
410
|
-
#
|
411
|
-
# # TODO: Initialize `entries`:
|
412
|
-
# entries = []
|
413
|
-
# response = logging_client.write_log_entries(entries)
|
414
|
-
|
415
|
-
def write_log_entries \
|
416
|
-
entries,
|
417
|
-
log_name: nil,
|
418
|
-
resource: nil,
|
419
|
-
labels: nil,
|
420
|
-
partial_success: nil,
|
421
|
-
dry_run: nil,
|
422
|
-
options: nil,
|
423
|
-
&block
|
424
|
-
req = {
|
425
|
-
entries: entries,
|
426
|
-
log_name: log_name,
|
427
|
-
resource: resource,
|
428
|
-
labels: labels,
|
429
|
-
partial_success: partial_success,
|
430
|
-
dry_run: dry_run
|
431
|
-
}.delete_if { |_, v| v.nil? }
|
432
|
-
req = Google::Gax::to_proto(req, Google::Logging::V2::WriteLogEntriesRequest)
|
433
|
-
@write_log_entries.call(req, options, &block)
|
434
|
-
end
|
435
|
-
|
436
320
|
# Deletes all the log entries in a log. The log reappears if it receives new
|
437
321
|
# entries. Log entries written shortly before the delete operation might not
|
438
322
|
# be deleted. Entries received after the delete operation with a timestamp
|
@@ -565,6 +449,122 @@ module Google
|
|
565
449
|
@list_log_entries.call(req, options, &block)
|
566
450
|
end
|
567
451
|
|
452
|
+
# Writes log entries to Logging. This API method is the
|
453
|
+
# only way to send log entries to Logging. This method
|
454
|
+
# is used, directly or indirectly, by the Logging agent
|
455
|
+
# (fluentd) and all logging libraries configured to use Logging.
|
456
|
+
# A single request may contain log entries for a maximum of 1000
|
457
|
+
# different resources (projects, organizations, billing accounts or
|
458
|
+
# folders)
|
459
|
+
#
|
460
|
+
# @param entries [Array<Google::Logging::V2::LogEntry | Hash>]
|
461
|
+
# Required. The log entries to send to Logging. The order of log
|
462
|
+
# entries in this list does not matter. Values supplied in this method's
|
463
|
+
# `log_name`, `resource`, and `labels` fields are copied into those log
|
464
|
+
# entries in this list that do not include values for their corresponding
|
465
|
+
# fields. For more information, see the
|
466
|
+
# {Google::Logging::V2::LogEntry LogEntry} type.
|
467
|
+
#
|
468
|
+
# If the `timestamp` or `insert_id` fields are missing in log entries, then
|
469
|
+
# this method supplies the current time or a unique identifier, respectively.
|
470
|
+
# The supplied values are chosen so that, among the log entries that did not
|
471
|
+
# supply their own values, the entries earlier in the list will sort before
|
472
|
+
# the entries later in the list. See the `entries.list` method.
|
473
|
+
#
|
474
|
+
# Log entries with timestamps that are more than the
|
475
|
+
# [logs retention period](https://cloud.google.com/logging/quota-policy) in the past or more than
|
476
|
+
# 24 hours in the future will not be available when calling `entries.list`.
|
477
|
+
# However, those log entries can still be
|
478
|
+
# [exported with LogSinks](https://cloud.google.com/logging/docs/api/tasks/exporting-logs).
|
479
|
+
#
|
480
|
+
# To improve throughput and to avoid exceeding the
|
481
|
+
# [quota limit](https://cloud.google.com/logging/quota-policy) for calls to `entries.write`,
|
482
|
+
# you should try to include several log entries in this list,
|
483
|
+
# rather than calling this method for each individual log entry.
|
484
|
+
# A hash of the same form as `Google::Logging::V2::LogEntry`
|
485
|
+
# can also be provided.
|
486
|
+
# @param log_name [String]
|
487
|
+
# Optional. A default log resource name that is assigned to all log entries
|
488
|
+
# in `entries` that do not specify a value for `log_name`:
|
489
|
+
#
|
490
|
+
# "projects/[PROJECT_ID]/logs/[LOG_ID]"
|
491
|
+
# "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
|
492
|
+
# "billingAccounts/[BILLING_ACCOUNT_ID]/logs/[LOG_ID]"
|
493
|
+
# "folders/[FOLDER_ID]/logs/[LOG_ID]"
|
494
|
+
#
|
495
|
+
# `[LOG_ID]` must be URL-encoded. For example:
|
496
|
+
#
|
497
|
+
# "projects/my-project-id/logs/syslog"
|
498
|
+
# "organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"
|
499
|
+
#
|
500
|
+
# The permission `logging.logEntries.create` is needed on each project,
|
501
|
+
# organization, billing account, or folder that is receiving new log
|
502
|
+
# entries, whether the resource is specified in `logName` or in an
|
503
|
+
# individual log entry.
|
504
|
+
# @param resource [Google::Api::MonitoredResource | Hash]
|
505
|
+
# Optional. A default monitored resource object that is assigned to all log
|
506
|
+
# entries in `entries` that do not specify a value for `resource`. Example:
|
507
|
+
#
|
508
|
+
# { "type": "gce_instance",
|
509
|
+
# "labels": {
|
510
|
+
# "zone": "us-central1-a", "instance_id": "00000000000000000000" }}
|
511
|
+
#
|
512
|
+
# See {Google::Logging::V2::LogEntry LogEntry}.
|
513
|
+
# A hash of the same form as `Google::Api::MonitoredResource`
|
514
|
+
# can also be provided.
|
515
|
+
# @param labels [Hash{String => String}]
|
516
|
+
# Optional. Default labels that are added to the `labels` field of all log
|
517
|
+
# entries in `entries`. If a log entry already has a label with the same key
|
518
|
+
# as a label in this parameter, then the log entry's label is not changed.
|
519
|
+
# See {Google::Logging::V2::LogEntry LogEntry}.
|
520
|
+
# @param partial_success [true, false]
|
521
|
+
# Optional. Whether valid entries should be written even if some other
|
522
|
+
# entries fail due to INVALID_ARGUMENT or PERMISSION_DENIED errors. If any
|
523
|
+
# entry is not written, then the response status is the error associated
|
524
|
+
# with one of the failed entries and the response includes error details
|
525
|
+
# keyed by the entries' zero-based index in the `entries.write` method.
|
526
|
+
# @param dry_run [true, false]
|
527
|
+
# Optional. If true, the request should expect normal response, but the
|
528
|
+
# entries won't be persisted nor exported. Useful for checking whether the
|
529
|
+
# logging API endpoints are working properly before sending valuable data.
|
530
|
+
# @param options [Google::Gax::CallOptions]
|
531
|
+
# Overrides the default settings for this call, e.g, timeout,
|
532
|
+
# retries, etc.
|
533
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
534
|
+
# @yieldparam result [Google::Logging::V2::WriteLogEntriesResponse]
|
535
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
536
|
+
# @return [Google::Logging::V2::WriteLogEntriesResponse]
|
537
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
538
|
+
# @example
|
539
|
+
# require "google/cloud/logging/v2"
|
540
|
+
#
|
541
|
+
# logging_client = Google::Cloud::Logging::V2::LoggingServiceV2Client.new
|
542
|
+
#
|
543
|
+
# # TODO: Initialize `entries`:
|
544
|
+
# entries = []
|
545
|
+
# response = logging_client.write_log_entries(entries)
|
546
|
+
|
547
|
+
def write_log_entries \
|
548
|
+
entries,
|
549
|
+
log_name: nil,
|
550
|
+
resource: nil,
|
551
|
+
labels: nil,
|
552
|
+
partial_success: nil,
|
553
|
+
dry_run: nil,
|
554
|
+
options: nil,
|
555
|
+
&block
|
556
|
+
req = {
|
557
|
+
entries: entries,
|
558
|
+
log_name: log_name,
|
559
|
+
resource: resource,
|
560
|
+
labels: labels,
|
561
|
+
partial_success: partial_success,
|
562
|
+
dry_run: dry_run
|
563
|
+
}.delete_if { |_, v| v.nil? }
|
564
|
+
req = Google::Gax::to_proto(req, Google::Logging::V2::WriteLogEntriesRequest)
|
565
|
+
@write_log_entries.call(req, options, &block)
|
566
|
+
end
|
567
|
+
|
568
568
|
# Lists the descriptors for monitored resource types used by Logging.
|
569
569
|
#
|
570
570
|
# @param page_size [Integer]
|