Class: Google::Cloud::Logging::Sink
- Inherits:
-
Object
- Object
- Google::Cloud::Logging::Sink
- Defined in:
- lib/google/cloud/logging/sink.rb,
lib/google/cloud/logging/sink/list.rb
Overview
Sink
Used to export log entries outside Stackdriver Logging. When you create a sink, new log entries are exported. Stackdriver Logging does not send previously-ingested log entries to the sink's destination.
A logs filter controls which log entries are exported.
Before creating the sink, ensure that you have granted
[email protected]
permission to write logs to the destination. See
Permissions for writing exported
logs.
You can retrieve an existing sink with Project#sink.
Defined Under Namespace
Classes: List
Instance Method Summary collapse
-
#delete ⇒ Boolean
Permanently deletes the logs-based sink.
-
#destination ⇒ Object
The export destination.
-
#destination=(destination) ⇒ Object
Updates the export destination.
-
#end_at ⇒ Object
(also: #end_time)
deprecated
Deprecated.
This field is ignored when creating or updating sinks.
-
#end_at=(_new_end_at) ⇒ Object
(also: #end_time=)
deprecated
Deprecated.
This field is ignored when creating or updating sinks.
-
#filter ⇒ Object
An advanced logs filter that defines the log entries to be exported.
-
#filter=(filter) ⇒ Object
Updates the advanced logs filter that defines the log entries to be exported.
-
#name ⇒ Object
The client-assigned sink identifier.
-
#reload! ⇒ Object
(also: #refresh!)
Reloads the logs-based sink with current data from the Logging service.
-
#save(unique_writer_identity: nil) ⇒ Object
Updates the logs-based sink.
-
#start_at ⇒ Object
(also: #start_time)
deprecated
Deprecated.
This field is ignored when creating or updating sinks.
-
#start_at=(_new_start_at) ⇒ Object
(also: #start_time=)
deprecated
Deprecated.
This field is ignored when creating or updating sinks.
-
#unspecified? ⇒ Boolean
deprecated
Deprecated.
The v2 format is used by default and cannot be changed.
-
#v1? ⇒ Boolean
deprecated
Deprecated.
The v2 format is used by default and cannot be changed.
-
#v2? ⇒ Boolean
deprecated
Deprecated.
The v2 format is used by default and cannot be changed.
-
#version ⇒ Object
deprecated
Deprecated.
The v2 format is used by default and cannot be changed.
-
#version=(_version) ⇒ Object
deprecated
Deprecated.
The v2 format is used by default and cannot be changed.
-
#writer_identity ⇒ Object
An IAM identity (a service account or group) that will write exported log entries to the destination on behalf of Stackdriver Logging.
Instance Method Details
#delete ⇒ Boolean
Permanently deletes the logs-based sink.
274 275 276 277 278 |
# File 'lib/google/cloud/logging/sink.rb', line 274 def delete ensure_service! service.delete_sink name true end |
#destination ⇒ Object
The export destination. See Exporting Logs With Sinks.
88 89 90 |
# File 'lib/google/cloud/logging/sink.rb', line 88 def destination @grpc.destination end |
#destination=(destination) ⇒ Object
Updates the export destination. See Exporting Logs With Sinks.
95 96 97 |
# File 'lib/google/cloud/logging/sink.rb', line 95 def destination= destination @grpc.destination = destination end |
#end_at ⇒ Object Also known as: end_time
This field is ignored when creating or updating sinks.
Deprecated. Time at which this sink will stop exporting log
entries. If this value is present, then log entries are exported only
if the log entry's timestamp is less than end_at
. Optional.
201 202 203 204 |
# File 'lib/google/cloud/logging/sink.rb', line 201 def end_at warn "[DEPRECATION] end_at is deprecated." nil end |
#end_at=(_new_end_at) ⇒ Object Also known as: end_time=
This field is ignored when creating or updating sinks.
Deprecated. Sets the time at which this sink will stop exporting
log entries. If this value is present, then log entries are exported
only if the log entry's timestamp is less than end_at
. Optional.
213 214 215 |
# File 'lib/google/cloud/logging/sink.rb', line 213 def end_at= _new_end_at warn "[DEPRECATION] end_at= is deprecated and will be ignored." end |
#filter ⇒ Object
An advanced logs
filter
that defines the log entries to be exported. The filter must be
consistent with the log entry format designed by the version
parameter, regardless of the format of the log entry that was
originally written to Stackdriver Logging.
106 107 108 |
# File 'lib/google/cloud/logging/sink.rb', line 106 def filter @grpc.filter end |
#filter=(filter) ⇒ Object
Updates the advanced logs
filter
that defines the log entries to be exported. The filter must be
consistent with the log entry format designed by the version
parameter, regardless of the format of the log entry that was
originally written to Stackdriver Logging.
117 118 119 |
# File 'lib/google/cloud/logging/sink.rb', line 117 def filter= filter @grpc.filter = filter end |
#name ⇒ Object
The client-assigned sink identifier. Sink identifiers are limited to
1000 characters and can include only the following characters: A-Z
,
a-z
, 0-9
, and the special characters _-.
.
81 82 83 |
# File 'lib/google/cloud/logging/sink.rb', line 81 def name @grpc.name end |
#reload! ⇒ Object Also known as: refresh!
Reloads the logs-based sink with current data from the Logging service.
256 257 258 259 |
# File 'lib/google/cloud/logging/sink.rb', line 256 def reload! ensure_service! @grpc = service.get_sink name end |
#save(unique_writer_identity: nil) ⇒ Object
Updates the logs-based sink.
246 247 248 249 250 251 |
# File 'lib/google/cloud/logging/sink.rb', line 246 def save unique_writer_identity: nil ensure_service! @grpc = service.update_sink \ name, destination, filter, unique_writer_identity: unique_writer_identity end |
#start_at ⇒ Object Also known as: start_time
This field is ignored when creating or updating sinks.
Deprecated. The time at which this sink will begin exporting log
entries. If this value is present, then log entries are exported only
if start_at
is less than the log entry's timestamp. Optional.
178 179 180 181 |
# File 'lib/google/cloud/logging/sink.rb', line 178 def start_at warn "[DEPRECATION] start_at is deprecated." nil end |
#start_at=(_new_start_at) ⇒ Object Also known as: start_time=
This field is ignored when creating or updating sinks.
Deprecated. Sets the time at which this sink will begin exporting
log entries. If this value is present, then log entries are exported
only if start_at
is less than the log entry's timestamp. Optional.
190 191 192 |
# File 'lib/google/cloud/logging/sink.rb', line 190 def start_at= _new_start_at warn "[DEPRECATION] start_at= is deprecated and will be ignored." end |
#unspecified? ⇒ Boolean
The v2 format is used by default and cannot be changed.
Helper to determine if the sink's version is
VERSION_FORMAT_UNSPECIFIED
.
149 150 151 152 |
# File 'lib/google/cloud/logging/sink.rb', line 149 def unspecified? warn "[DEPRECATION] unspecified? is deprecated." false end |
#v1? ⇒ Boolean
The v2 format is used by default and cannot be changed.
Helper to determine if the sink's version is V1
.
167 168 169 170 |
# File 'lib/google/cloud/logging/sink.rb', line 167 def v1? warn "[DEPRECATION] v1? is deprecated." false end |
#v2? ⇒ Boolean
The v2 format is used by default and cannot be changed.
Helper to determine if the sink's version is V2
.
158 159 160 161 |
# File 'lib/google/cloud/logging/sink.rb', line 158 def v2? warn "[DEPRECATION] v2? is deprecated." true end |
#version ⇒ Object
The v2 format is used by default and cannot be changed.
Deprecated. The log entry version used when exporting log entries from this sink. This version does not have to correspond to the version of the log entry when it was written to Stackdriver Logging.
127 128 129 130 |
# File 'lib/google/cloud/logging/sink.rb', line 127 def version warn "[DEPRECATION] version is deprecated." :V2 end |
#version=(_version) ⇒ Object
The v2 format is used by default and cannot be changed.
Deprecated. Updates the log entry version used when exporting log
entries from this sink. This version does not have to correspond to
the version of the log entry when it was written to Stackdriver
Logging. Accepted values are :VERSION_FORMAT_UNSPECIFIED
, :V2
, and
:V1
.
140 141 142 |
# File 'lib/google/cloud/logging/sink.rb', line 140 def version= _version warn "[DEPRECATION] version= is deprecated and will be ignored." end |
#writer_identity ⇒ Object
An IAM identity (a service account or group) that will write exported log entries to the destination on behalf of Stackdriver Logging. You must grant this identity write-access to the destination. Consult the destination service's documentation to determine the exact role that must be granted.
224 225 226 |
# File 'lib/google/cloud/logging/sink.rb', line 224 def writer_identity @grpc.writer_identity end |