google-cloud-logging 0.21.2 → 0.23.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +0 -3
- data/lib/google/cloud/logging/entry/list.rb +8 -7
- data/lib/google/cloud/logging/logger.rb +2 -2
- data/lib/google/cloud/logging/metric/list.rb +1 -1
- data/lib/google/cloud/logging/middleware.rb +27 -23
- data/lib/google/cloud/logging/project.rb +41 -12
- data/lib/google/cloud/logging/resource_descriptor.rb +1 -1
- data/lib/google/cloud/logging/service.rb +47 -18
- data/lib/google/cloud/logging/sink.rb +81 -2
- data/lib/google/cloud/logging/sink/list.rb +1 -1
- data/lib/google/cloud/logging/v2.rb +3 -3
- data/lib/google/cloud/logging/v2/{config_service_v2_api.rb → config_service_v2_client.rb} +82 -52
- data/lib/google/cloud/logging/v2/doc/google/api/label.rb +41 -0
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/log_entry.rb +17 -12
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging.rb +28 -8
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging_config.rb +72 -36
- data/lib/google/cloud/logging/v2/doc/google/logging/v2/logging_metrics.rb +39 -25
- data/lib/google/cloud/logging/v2/{logging_service_v2_api.rb → logging_service_v2_client.rb} +65 -43
- data/lib/google/cloud/logging/v2/{metrics_service_v2_api.rb → metrics_service_v2_client.rb} +57 -52
- data/lib/google/cloud/logging/version.rb +1 -1
- data/lib/google/logging/v2/logging_config_pb.rb +4 -0
- data/lib/google/logging/v2/logging_config_services_pb.rb +2 -2
- data/lib/google/logging/v2/logging_services_pb.rb +2 -2
- metadata +8 -21
@@ -15,33 +15,38 @@
|
|
15
15
|
module Google
|
16
16
|
module Logging
|
17
17
|
module V2
|
18
|
-
# Describes a sink used to export log entries outside Stackdriver Logging.
|
18
|
+
# Describes a sink used to export log entries outside of Stackdriver Logging.
|
19
|
+
# A logs filter controls which log entries are exported. Sinks can have a
|
20
|
+
# start time and an end time; these can be used to place log entries from an
|
21
|
+
# exact time range into a particular destination. If both +start_time+ and
|
22
|
+
# +end_time+ are present, then +start_time+ must be less than +end_time+.
|
19
23
|
# @!attribute [rw] name
|
20
24
|
# @return [String]
|
21
25
|
# Required. The client-assigned sink identifier, unique within the
|
22
26
|
# project. Example: +"my-syslog-errors-to-pubsub"+. Sink identifiers are
|
23
|
-
# limited to
|
24
|
-
#
|
25
|
-
#
|
27
|
+
# limited to 100 characters and can include only the following characters:
|
28
|
+
# upper and lower-case alphanumeric characters, underscores, hyphens, and
|
29
|
+
# periods.
|
26
30
|
# @!attribute [rw] destination
|
27
31
|
# @return [String]
|
28
|
-
# Required. The export destination
|
29
|
-
#
|
30
|
-
#
|
32
|
+
# Required. The export destination:
|
33
|
+
#
|
34
|
+
# "storage.googleapis.com/[GCS_BUCKET]"
|
35
|
+
# "bigquery.googleapis.com/projects/[PROJECT_ID]/datasets/[DATASET]"
|
36
|
+
# "pubsub.googleapis.com/projects/[PROJECT_ID]/topics/[TOPIC_ID]"
|
31
37
|
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
# "pubsub.googleapis.com/projects/my-project/topics/my-topic"
|
38
|
+
# For more information, see
|
39
|
+
# {Exporting Logs With Sinks}[https://cloud.google.com/logging/docs/api/tasks/exporting-logs].
|
35
40
|
# @!attribute [rw] filter
|
36
41
|
# @return [String]
|
37
42
|
# Optional. An {advanced logs filter}[https://cloud.google.com/logging/docs/view/advanced_filters].
|
38
43
|
# Only log entries matching the filter are exported. The filter
|
39
44
|
# must be consistent with the log entry format specified by the
|
40
45
|
# +outputVersionFormat+ parameter, regardless of the format of the
|
41
|
-
# log entry that was originally
|
42
|
-
#
|
46
|
+
# log entry that was originally ingested by Stackdriver Logging.
|
47
|
+
# The following example uses field names in the v2 log entry format:
|
43
48
|
#
|
44
|
-
# logName=projects/
|
49
|
+
# logName="projects/[PROJECT_ID]/logs/[LOG_ID]" AND severity>=ERROR
|
45
50
|
# @!attribute [rw] output_version_format
|
46
51
|
# @return [Google::Logging::V2::LogSink::VersionFormat]
|
47
52
|
# Optional. The log entry version to use for this sink's exported log
|
@@ -50,18 +55,23 @@ module Google
|
|
50
55
|
# v2 format is used.
|
51
56
|
# @!attribute [rw] writer_identity
|
52
57
|
# @return [String]
|
53
|
-
# Output only.
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
60
|
-
#
|
61
|
-
#
|
62
|
-
#
|
58
|
+
# Output only. An IAM identity—a service account or group—that
|
59
|
+
# will write exported log entries to the destination on behalf of Stackdriver
|
60
|
+
# Logging. You must grant this identity write-access to the destination.
|
61
|
+
# Consult the destination service's documentation to determine the exact role
|
62
|
+
# that must be granted.
|
63
|
+
# @!attribute [rw] start_time
|
64
|
+
# @return [Google::Protobuf::Timestamp]
|
65
|
+
# Optional. The time at which this sink will begin exporting log entries. If
|
66
|
+
# this value is present, then log entries are exported only if +start_time+
|
67
|
+
# <=+entry.timestamp+.
|
68
|
+
# @!attribute [rw] end_time
|
69
|
+
# @return [Google::Protobuf::Timestamp]
|
70
|
+
# Optional. Time at which this sink will stop exporting log entries. If this
|
71
|
+
# value is present, then log entries are exported only if +entry.timestamp+ <
|
72
|
+
# +end_time+.
|
63
73
|
class LogSink
|
64
|
-
# Available log entry formats. Log entries can be written to
|
74
|
+
# Available log entry formats. Log entries can be written to Stackdriver
|
65
75
|
# Logging in either format and can be exported in either format.
|
66
76
|
# Version 2 is the preferred format.
|
67
77
|
module VersionFormat
|
@@ -79,8 +89,10 @@ module Google
|
|
79
89
|
# The parameters to +ListSinks+.
|
80
90
|
# @!attribute [rw] parent
|
81
91
|
# @return [String]
|
82
|
-
# Required. The
|
83
|
-
#
|
92
|
+
# Required. The resource name where this sink was created:
|
93
|
+
#
|
94
|
+
# "projects/[PROJECT_ID]"
|
95
|
+
# "organizations/[ORGANIZATION_ID]"
|
84
96
|
# @!attribute [rw] page_token
|
85
97
|
# @return [String]
|
86
98
|
# Optional. If present, then retrieve the next batch of results from the
|
@@ -108,42 +120,66 @@ module Google
|
|
108
120
|
# The parameters to +GetSink+.
|
109
121
|
# @!attribute [rw] sink_name
|
110
122
|
# @return [String]
|
111
|
-
# Required. The resource name of the sink to return
|
112
|
-
#
|
123
|
+
# Required. The resource name of the sink to return:
|
124
|
+
#
|
125
|
+
# "projects/[PROJECT_ID]/sinks/[SINK_ID]"
|
126
|
+
# "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
|
113
127
|
class GetSinkRequest; end
|
114
128
|
|
115
129
|
# The parameters to +CreateSink+.
|
116
130
|
# @!attribute [rw] parent
|
117
131
|
# @return [String]
|
118
|
-
# Required. The resource in which to create the sink
|
119
|
-
#
|
120
|
-
#
|
132
|
+
# Required. The resource in which to create the sink:
|
133
|
+
#
|
134
|
+
# "projects/[PROJECT_ID]"
|
135
|
+
# "organizations/[ORGANIZATION_ID]"
|
121
136
|
# @!attribute [rw] sink
|
122
137
|
# @return [Google::Logging::V2::LogSink]
|
123
138
|
# Required. The new sink, whose +name+ parameter is a sink identifier that
|
124
139
|
# is not already in use.
|
140
|
+
# @!attribute [rw] unique_writer_identity
|
141
|
+
# @return [true, false]
|
142
|
+
# Optional. Whether the sink will have a dedicated service account returned
|
143
|
+
# in the sink's writer_identity. Set this field to be true to export
|
144
|
+
# logs from one project to a different project. This field is ignored for
|
145
|
+
# non-project sinks (e.g. organization sinks) because those sinks are
|
146
|
+
# required to have dedicated service accounts.
|
125
147
|
class CreateSinkRequest; end
|
126
148
|
|
127
149
|
# The parameters to +UpdateSink+.
|
128
150
|
# @!attribute [rw] sink_name
|
129
151
|
# @return [String]
|
130
152
|
# Required. The resource name of the sink to update, including the parent
|
131
|
-
# resource and the sink identifier
|
132
|
-
#
|
153
|
+
# resource and the sink identifier:
|
154
|
+
#
|
155
|
+
# "projects/[PROJECT_ID]/sinks/[SINK_ID]"
|
156
|
+
# "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
|
157
|
+
#
|
158
|
+
# Example: +"projects/my-project-id/sinks/my-sink-id"+.
|
133
159
|
# @!attribute [rw] sink
|
134
160
|
# @return [Google::Logging::V2::LogSink]
|
135
161
|
# Required. The updated sink, whose name is the same identifier that appears
|
136
162
|
# as part of +sinkName+. If +sinkName+ does not exist, then
|
137
163
|
# this method creates a new sink.
|
164
|
+
# @!attribute [rw] unique_writer_identity
|
165
|
+
# @return [true, false]
|
166
|
+
# Optional. Whether the sink will have a dedicated service account returned
|
167
|
+
# in the sink's writer_identity. Set this field to be true to export
|
168
|
+
# logs from one project to a different project. This field is ignored for
|
169
|
+
# non-project sinks (e.g. organization sinks) because those sinks are
|
170
|
+
# required to have dedicated service accounts.
|
138
171
|
class UpdateSinkRequest; end
|
139
172
|
|
140
173
|
# The parameters to +DeleteSink+.
|
141
174
|
# @!attribute [rw] sink_name
|
142
175
|
# @return [String]
|
143
176
|
# Required. The resource name of the sink to delete, including the parent
|
144
|
-
# resource and the sink identifier
|
145
|
-
#
|
146
|
-
#
|
177
|
+
# resource and the sink identifier:
|
178
|
+
#
|
179
|
+
# "projects/[PROJECT_ID]/sinks/[SINK_ID]"
|
180
|
+
# "organizations/[ORGANIZATION_ID]/sinks/[SINK_ID]"
|
181
|
+
#
|
182
|
+
# It is an error if the sink does not exist.
|
147
183
|
class DeleteSinkRequest; end
|
148
184
|
end
|
149
185
|
end
|
@@ -19,21 +19,32 @@ module Google
|
|
19
19
|
# number of log entries that match a logs filter.
|
20
20
|
# @!attribute [rw] name
|
21
21
|
# @return [String]
|
22
|
-
# Required. The client-assigned metric identifier.
|
23
|
-
# +"
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
#
|
22
|
+
# Required. The client-assigned metric identifier.
|
23
|
+
# Examples: +"error_count"+, +"nginx/requests"+.
|
24
|
+
#
|
25
|
+
# Metric identifiers are limited to 100 characters and can include
|
26
|
+
# only the following characters: +A-Z+, +a-z+, +0-9+, and the
|
27
|
+
# special characters +_-.,+!*',()%/+. The forward-slash character
|
28
|
+
# (+/+) denotes a hierarchy of name pieces, and it cannot be the
|
29
|
+
# first character of the name.
|
30
|
+
#
|
31
|
+
# The metric identifier in this field must not be
|
32
|
+
# {URL-encoded}[https://en.wikipedia.org/wiki/Percent-encoding].
|
33
|
+
# However, when the metric identifier appears as the +[METRIC_ID]+
|
34
|
+
# part of a +metric_name+ API parameter, then the metric identifier
|
35
|
+
# must be URL-encoded. Example:
|
36
|
+
# +"projects/my-project/metrics/nginx%2Frequests"+.
|
30
37
|
# @!attribute [rw] description
|
31
38
|
# @return [String]
|
32
39
|
# Optional. A description of this metric, which is used in documentation.
|
33
40
|
# @!attribute [rw] filter
|
34
41
|
# @return [String]
|
35
42
|
# Required. An {advanced logs filter}[https://cloud.google.com/logging/docs/view/advanced_filters].
|
36
|
-
# Example:
|
43
|
+
# Example:
|
44
|
+
#
|
45
|
+
# "resource.type=gae_app AND severity>=ERROR"
|
46
|
+
#
|
47
|
+
# The maximum length of the filter is 20000 characters.
|
37
48
|
# @!attribute [rw] version
|
38
49
|
# @return [Google::Logging::V2::LogMetric::ApiVersion]
|
39
50
|
# Output only. The API version that created or updated this metric.
|
@@ -53,8 +64,9 @@ module Google
|
|
53
64
|
# The parameters to ListLogMetrics.
|
54
65
|
# @!attribute [rw] parent
|
55
66
|
# @return [String]
|
56
|
-
# Required. The
|
57
|
-
#
|
67
|
+
# Required. The name of the project containing the metrics:
|
68
|
+
#
|
69
|
+
# "projects/[PROJECT_ID]"
|
58
70
|
# @!attribute [rw] page_token
|
59
71
|
# @return [String]
|
60
72
|
# Optional. If present, then retrieve the next batch of results from the
|
@@ -82,15 +94,17 @@ module Google
|
|
82
94
|
# The parameters to GetLogMetric.
|
83
95
|
# @!attribute [rw] metric_name
|
84
96
|
# @return [String]
|
85
|
-
# The resource name of the desired metric
|
86
|
-
#
|
97
|
+
# The resource name of the desired metric:
|
98
|
+
#
|
99
|
+
# "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
|
87
100
|
class GetLogMetricRequest; end
|
88
101
|
|
89
102
|
# The parameters to CreateLogMetric.
|
90
103
|
# @!attribute [rw] parent
|
91
104
|
# @return [String]
|
92
|
-
# The resource name of the project in which to create the metric
|
93
|
-
#
|
105
|
+
# The resource name of the project in which to create the metric:
|
106
|
+
#
|
107
|
+
# "projects/[PROJECT_ID]"
|
94
108
|
#
|
95
109
|
# The new metric must be provided in the request.
|
96
110
|
# @!attribute [rw] metric
|
@@ -102,24 +116,24 @@ module Google
|
|
102
116
|
# The parameters to UpdateLogMetric.
|
103
117
|
# @!attribute [rw] metric_name
|
104
118
|
# @return [String]
|
105
|
-
# The resource name of the metric to update
|
106
|
-
# Example: +"projects/my-project-id/metrics/my-metric-id"+.
|
119
|
+
# The resource name of the metric to update:
|
107
120
|
#
|
108
|
-
#
|
109
|
-
#
|
110
|
-
#
|
121
|
+
# "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
|
122
|
+
#
|
123
|
+
# The updated metric must be provided in the request and it's
|
124
|
+
# +name+ field must be the same as +[METRIC_ID]+ If the metric
|
125
|
+
# does not exist in +[PROJECT_ID]+, then a new metric is created.
|
111
126
|
# @!attribute [rw] metric
|
112
127
|
# @return [Google::Logging::V2::LogMetric]
|
113
|
-
# The updated metric
|
114
|
-
# metric identifier in +metricName+. If +metricName+ does not
|
115
|
-
# exist, then a new metric is created.
|
128
|
+
# The updated metric.
|
116
129
|
class UpdateLogMetricRequest; end
|
117
130
|
|
118
131
|
# The parameters to DeleteLogMetric.
|
119
132
|
# @!attribute [rw] metric_name
|
120
133
|
# @return [String]
|
121
|
-
# The resource name of the metric to delete
|
122
|
-
#
|
134
|
+
# The resource name of the metric to delete:
|
135
|
+
#
|
136
|
+
# "projects/[PROJECT_ID]/metrics/[METRIC_ID]"
|
123
137
|
class DeleteLogMetricRequest; end
|
124
138
|
end
|
125
139
|
end
|
@@ -36,7 +36,7 @@ module Google
|
|
36
36
|
#
|
37
37
|
# @!attribute [r] logging_service_v2_stub
|
38
38
|
# @return [Google::Logging::V2::LoggingServiceV2::Stub]
|
39
|
-
class
|
39
|
+
class LoggingServiceV2Client
|
40
40
|
attr_reader :logging_service_v2_stub
|
41
41
|
|
42
42
|
# The default address of the service.
|
@@ -72,11 +72,11 @@ module Google
|
|
72
72
|
"https://www.googleapis.com/auth/logging.write"
|
73
73
|
].freeze
|
74
74
|
|
75
|
-
|
75
|
+
PROJECT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
76
76
|
"projects/{project}"
|
77
77
|
)
|
78
78
|
|
79
|
-
private_constant :
|
79
|
+
private_constant :PROJECT_PATH_TEMPLATE
|
80
80
|
|
81
81
|
LOG_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
82
82
|
"projects/{project}/logs/{log}"
|
@@ -84,11 +84,11 @@ module Google
|
|
84
84
|
|
85
85
|
private_constant :LOG_PATH_TEMPLATE
|
86
86
|
|
87
|
-
# Returns a fully-qualified
|
87
|
+
# Returns a fully-qualified project resource name string.
|
88
88
|
# @param project [String]
|
89
89
|
# @return [String]
|
90
|
-
def self.
|
91
|
-
|
90
|
+
def self.project_path project
|
91
|
+
PROJECT_PATH_TEMPLATE.render(
|
92
92
|
:"project" => project
|
93
93
|
)
|
94
94
|
end
|
@@ -104,11 +104,11 @@ module Google
|
|
104
104
|
)
|
105
105
|
end
|
106
106
|
|
107
|
-
# Parses the project from a
|
108
|
-
# @param
|
107
|
+
# Parses the project from a project resource.
|
108
|
+
# @param project_name [String]
|
109
109
|
# @return [String]
|
110
|
-
def self.
|
111
|
-
|
110
|
+
def self.match_project_from_project_name project_name
|
111
|
+
PROJECT_PATH_TEMPLATE.match(project_name)["project"]
|
112
112
|
end
|
113
113
|
|
114
114
|
# Parses the project from a log resource.
|
@@ -160,6 +160,7 @@ module Google
|
|
160
160
|
require "google/gax/grpc"
|
161
161
|
require "google/logging/v2/logging_services_pb"
|
162
162
|
|
163
|
+
|
163
164
|
google_api_client = "#{app_name}/#{app_version} " \
|
164
165
|
"#{CODE_GEN_NAME_VERSION} gax/#{Google::Gax::VERSION} " \
|
165
166
|
"ruby/#{RUBY_VERSION}".freeze
|
@@ -208,24 +209,32 @@ module Google
|
|
208
209
|
|
209
210
|
# Service calls
|
210
211
|
|
211
|
-
# Deletes
|
212
|
-
# The log
|
212
|
+
# Deletes all the log entries in a log.
|
213
|
+
# The log reappears if it receives new entries.
|
213
214
|
#
|
214
215
|
# @param log_name [String]
|
215
|
-
# Required. The resource name of the log to delete
|
216
|
-
#
|
216
|
+
# Required. The resource name of the log to delete:
|
217
|
+
#
|
218
|
+
# "projects/[PROJECT_ID]/logs/[LOG_ID]"
|
219
|
+
# "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
|
220
|
+
#
|
221
|
+
# +[LOG_ID]+ must be URL-encoded. For example,
|
222
|
+
# +"projects/my-project-id/logs/syslog"+,
|
223
|
+
# +"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"+.
|
224
|
+
# For more information about log names, see
|
225
|
+
# LogEntry.
|
217
226
|
# @param options [Google::Gax::CallOptions]
|
218
227
|
# Overrides the default settings for this call, e.g, timeout,
|
219
228
|
# retries, etc.
|
220
229
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
221
230
|
# @example
|
222
|
-
# require "google/cloud/logging/v2/
|
231
|
+
# require "google/cloud/logging/v2/logging_service_v2_client"
|
223
232
|
#
|
224
|
-
#
|
233
|
+
# LoggingServiceV2Client = Google::Cloud::Logging::V2::LoggingServiceV2Client
|
225
234
|
#
|
226
|
-
#
|
227
|
-
# formatted_log_name =
|
228
|
-
#
|
235
|
+
# logging_service_v2_client = LoggingServiceV2Client.new
|
236
|
+
# formatted_log_name = LoggingServiceV2Client.log_path("[PROJECT]", "[LOG]")
|
237
|
+
# logging_service_v2_client.delete_log(formatted_log_name)
|
229
238
|
|
230
239
|
def delete_log \
|
231
240
|
log_name,
|
@@ -234,6 +243,7 @@ module Google
|
|
234
243
|
log_name: log_name
|
235
244
|
}.delete_if { |_, v| v.nil? })
|
236
245
|
@delete_log.call(req, options)
|
246
|
+
nil
|
237
247
|
end
|
238
248
|
|
239
249
|
# Writes log entries to Stackdriver Logging. All log entries are
|
@@ -241,8 +251,15 @@ module Google
|
|
241
251
|
#
|
242
252
|
# @param log_name [String]
|
243
253
|
# Optional. A default log resource name that is assigned to all log entries
|
244
|
-
# in +entries+ that do not specify a value for +log_name
|
245
|
-
#
|
254
|
+
# in +entries+ that do not specify a value for +log_name+:
|
255
|
+
#
|
256
|
+
# "projects/[PROJECT_ID]/logs/[LOG_ID]"
|
257
|
+
# "organizations/[ORGANIZATION_ID]/logs/[LOG_ID]"
|
258
|
+
#
|
259
|
+
# +[LOG_ID]+ must be URL-encoded. For example,
|
260
|
+
# +"projects/my-project-id/logs/syslog"+ or
|
261
|
+
# +"organizations/1234567890/logs/cloudresourcemanager.googleapis.com%2Factivity"+.
|
262
|
+
# For more information about log names, see
|
246
263
|
# LogEntry.
|
247
264
|
# @param resource [Google::Api::MonitoredResource]
|
248
265
|
# Optional. A default monitored resource object that is assigned to all log
|
@@ -280,13 +297,13 @@ module Google
|
|
280
297
|
# @return [Google::Logging::V2::WriteLogEntriesResponse]
|
281
298
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
282
299
|
# @example
|
283
|
-
# require "google/cloud/logging/v2/
|
300
|
+
# require "google/cloud/logging/v2/logging_service_v2_client"
|
284
301
|
#
|
285
|
-
#
|
302
|
+
# LoggingServiceV2Client = Google::Cloud::Logging::V2::LoggingServiceV2Client
|
286
303
|
#
|
287
|
-
#
|
304
|
+
# logging_service_v2_client = LoggingServiceV2Client.new
|
288
305
|
# entries = []
|
289
|
-
# response =
|
306
|
+
# response = logging_service_v2_client.write_log_entries(entries)
|
290
307
|
|
291
308
|
def write_log_entries \
|
292
309
|
entries,
|
@@ -311,18 +328,23 @@ module Google
|
|
311
328
|
#
|
312
329
|
# @param project_ids [Array<String>]
|
313
330
|
# Deprecated. One or more project identifiers or project numbers from which
|
314
|
-
# to retrieve log entries.
|
331
|
+
# to retrieve log entries. Example: +"my-project-1A"+. If
|
315
332
|
# present, these project identifiers are converted to resource format and
|
316
333
|
# added to the list of resources in +resourceNames+. Callers should use
|
317
334
|
# +resourceNames+ rather than this parameter.
|
318
335
|
# @param resource_names [Array<String>]
|
319
|
-
#
|
320
|
-
#
|
321
|
-
#
|
336
|
+
# Required. One or more cloud resources from which to retrieve log
|
337
|
+
# entries:
|
338
|
+
#
|
339
|
+
# "projects/[PROJECT_ID]"
|
340
|
+
# "organizations/[ORGANIZATION_ID]"
|
341
|
+
#
|
342
|
+
# Projects listed in the +project_ids+ field are added to this list.
|
322
343
|
# @param filter [String]
|
323
344
|
# Optional. A filter that chooses which log entries to return. See {Advanced
|
324
345
|
# Logs Filters}[https://cloud.google.com/logging/docs/view/advanced_filters]. Only log entries that
|
325
346
|
# match the filter are returned. An empty filter matches all log entries.
|
347
|
+
# The maximum length of the filter is 20000 characters.
|
326
348
|
# @param order_by [String]
|
327
349
|
# Optional. How the results should be sorted. Presently, the only permitted
|
328
350
|
# values are +"timestamp asc"+ (default) and +"timestamp desc"+. The first
|
@@ -346,20 +368,20 @@ module Google
|
|
346
368
|
# object.
|
347
369
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
348
370
|
# @example
|
349
|
-
# require "google/cloud/logging/v2/
|
371
|
+
# require "google/cloud/logging/v2/logging_service_v2_client"
|
350
372
|
#
|
351
|
-
#
|
373
|
+
# LoggingServiceV2Client = Google::Cloud::Logging::V2::LoggingServiceV2Client
|
352
374
|
#
|
353
|
-
#
|
354
|
-
#
|
375
|
+
# logging_service_v2_client = LoggingServiceV2Client.new
|
376
|
+
# resource_names = []
|
355
377
|
#
|
356
378
|
# # Iterate over all results.
|
357
|
-
#
|
379
|
+
# logging_service_v2_client.list_log_entries(resource_names).each do |element|
|
358
380
|
# # Process element.
|
359
381
|
# end
|
360
382
|
#
|
361
383
|
# # Or iterate over results one page at a time.
|
362
|
-
#
|
384
|
+
# logging_service_v2_client.list_log_entries(resource_names).each_page do |page|
|
363
385
|
# # Process each page at a time.
|
364
386
|
# page.each do |element|
|
365
387
|
# # Process element.
|
@@ -367,15 +389,15 @@ module Google
|
|
367
389
|
# end
|
368
390
|
|
369
391
|
def list_log_entries \
|
370
|
-
|
371
|
-
|
392
|
+
resource_names,
|
393
|
+
project_ids: nil,
|
372
394
|
filter: nil,
|
373
395
|
order_by: nil,
|
374
396
|
page_size: nil,
|
375
397
|
options: nil
|
376
398
|
req = Google::Logging::V2::ListLogEntriesRequest.new({
|
377
|
-
project_ids: project_ids,
|
378
399
|
resource_names: resource_names,
|
400
|
+
project_ids: project_ids,
|
379
401
|
filter: filter,
|
380
402
|
order_by: order_by,
|
381
403
|
page_size: page_size
|
@@ -401,19 +423,19 @@ module Google
|
|
401
423
|
# object.
|
402
424
|
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
403
425
|
# @example
|
404
|
-
# require "google/cloud/logging/v2/
|
426
|
+
# require "google/cloud/logging/v2/logging_service_v2_client"
|
405
427
|
#
|
406
|
-
#
|
428
|
+
# LoggingServiceV2Client = Google::Cloud::Logging::V2::LoggingServiceV2Client
|
407
429
|
#
|
408
|
-
#
|
430
|
+
# logging_service_v2_client = LoggingServiceV2Client.new
|
409
431
|
#
|
410
432
|
# # Iterate over all results.
|
411
|
-
#
|
433
|
+
# logging_service_v2_client.list_monitored_resource_descriptors.each do |element|
|
412
434
|
# # Process element.
|
413
435
|
# end
|
414
436
|
#
|
415
437
|
# # Or iterate over results one page at a time.
|
416
|
-
#
|
438
|
+
# logging_service_v2_client.list_monitored_resource_descriptors.each_page do |page|
|
417
439
|
# # Process each page at a time.
|
418
440
|
# page.each do |element|
|
419
441
|
# # Process element.
|