Package com.google.cloud.logging
Class Sink.Builder
- java.lang.Object
-
- com.google.cloud.logging.SinkInfo.Builder
-
- com.google.cloud.logging.Sink.Builder
-
- Enclosing class:
- Sink
public static final class Sink.Builder extends SinkInfo.Builder
A builder forSink
objects.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Sink
build()
Creates aSinkInfo
object for this builder.Sink.Builder
setDestination(SinkInfo.Destination destination)
Sets the export destination.Sink.Builder
setFilter(String filter)
Sets an advanced logs filter.Sink.Builder
setName(String name)
Sets the name of the sink.Sink.Builder
setVersionFormat(SinkInfo.VersionFormat versionFormat)
Sets the log entry version to use for this sink's exported log entries.
-
-
-
Method Detail
-
setName
@CanIgnoreReturnValue public Sink.Builder setName(String name)
Description copied from class:SinkInfo.Builder
Sets the name of the sink. Example:my-severe-errors-to-pubsub
. Sink identifiers are limited to 1000 characters and can include only the following characters:A-Z
,a-z
,0-9
, and the special characters_-.
.- Specified by:
setName
in classSinkInfo.Builder
-
setDestination
@CanIgnoreReturnValue public Sink.Builder setDestination(SinkInfo.Destination destination)
Description copied from class:SinkInfo.Builder
Sets the export destination. Use aSinkInfo.Destination.BucketDestination
object to create a sink that exports logs to a Google Cloud Storage bucket. Use aSinkInfo.Destination.DatasetDestination
object to create a sink that exports logs to a Google Cloud BigQuery dataset. Use aSinkInfo.Destination.TopicDestination
object to create a sink that exports logs to a Google Cloud Pub/Sub topic.- Specified by:
setDestination
in classSinkInfo.Builder
- See Also:
- Exporting Logs
-
setFilter
@CanIgnoreReturnValue public Sink.Builder setFilter(String filter)
Description copied from class:SinkInfo.Builder
Sets an advanced logs filter. Only log entries matching that filter are exported. The filter must be consistent with the log entry format specified withSinkInfo.Builder.setVersionFormat(VersionFormat)
, regardless of the format of the log entry that was originally written to Cloud Logging. Example (V2 format):logName=projects/my-projectid/logs/syslog AND severity>=ERROR
.- Specified by:
setFilter
in classSinkInfo.Builder
- See Also:
- Advanced Log Filters
-
setVersionFormat
@CanIgnoreReturnValue public Sink.Builder setVersionFormat(SinkInfo.VersionFormat versionFormat)
Description copied from class:SinkInfo.Builder
Sets the log entry version to use for this sink's exported log entries. This version does not have to correspond to the version of the log entry when it was written to Google Cloud Logging.- Specified by:
setVersionFormat
in classSinkInfo.Builder
-
build
public Sink build()
Description copied from class:SinkInfo.Builder
Creates aSinkInfo
object for this builder.- Specified by:
build
in classSinkInfo.Builder
-
-