Package com.google.cloud.logging
Class SinkInfo
- java.lang.Object
-
- com.google.cloud.logging.SinkInfo
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Sink
public class SinkInfo extends Object implements Serializable
Cloud Logging sinks can be used to control the export of your logs. Each sink specifies the export of a set of log entries to a certain destination. A sink consists of a name, unique to the project, a filter for choosing the log entries to export and a destination for the log entries.Sink destination can either be a Google Cloud Storage bucket (see
SinkInfo.Destination.BucketDestination
, a Google Cloud BigQuery dataset (seeSinkInfo.Destination.DatasetDestination
) or a Google Cloud Pub/Sub topic (seeSinkInfo.Destination.TopicDestination
).- See Also:
- About Sinks, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SinkInfo.Builder
A builder forSinkInfo
objects.static class
SinkInfo.Destination
static class
SinkInfo.VersionFormat
Available log entry formats.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
<T extends SinkInfo.Destination>
TgetDestination()
Returns the export destination.String
getFilter()
Returns an advanced logs filter.String
getName()
Returns the name of the sink.SinkInfo.VersionFormat
getVersionFormat()
Returns the log entry version to use for this sink's exported log entries.int
hashCode()
static SinkInfo.Builder
newBuilder(String name, SinkInfo.Destination destination)
Returns a builder forSinkInfo
objects given the name of the sink and its destination.static SinkInfo
of(String name, SinkInfo.Destination destination)
Creates aSinkInfo
object given the name of the sink and its destination.SinkInfo.Builder
toBuilder()
Returns a builder for thisSinkInfo
object.String
toString()
-
-
-
Method Detail
-
getName
public String getName()
Returns 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_-.
.
-
getDestination
public <T extends SinkInfo.Destination> T getDestination()
Returns the export destination. This method returns aSinkInfo.Destination.BucketDestination
for sinks that export logs to Google Cloud Storage buckets. ReturnsSinkInfo.Destination.DatasetDestination
for sinks that export logs to Google Cloud BigQuery datasets. ReturnsSinkInfo.Destination.TopicDestination
for sinks that export logs to Google Cloud Pub/Sub topics.- See Also:
- Exporting Logs
-
getFilter
public String getFilter()
Returns an advanced logs filter. Only log entries matching that filter are exported. The filter must be consistent with the log entry format specified ingetVersionFormat()
, regardless of the format of the log entry that wa originally written to Cloud Logging. Example (V2 format):logName=projects/my-projectid/logs/syslog AND severity>=ERROR
.- See Also:
- Advanced Log Filters
-
getVersionFormat
public SinkInfo.VersionFormat getVersionFormat()
Returns 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.
-
toBuilder
public SinkInfo.Builder toBuilder()
Returns a builder for thisSinkInfo
object.
-
newBuilder
public static SinkInfo.Builder newBuilder(String name, SinkInfo.Destination destination)
Returns a builder forSinkInfo
objects given the name of the sink and its destination.
-
of
public static SinkInfo of(String name, SinkInfo.Destination destination)
Creates aSinkInfo
object given the name of the sink and its destination.
-
-