< Back

Set-GcLogSink

Mon Jan 13, 2020 11:52 pm

NAME Set-GcLogSink



SYNOPSIS

Updates properties of a log sink. If the sink does not exist, the cmdlet will create the sink.





SYNTAX

Set-GcLogSink -GcsBucketDestination <string> [-UniqueWriterIdentity <SwitchParameter>] [-Project <string>]

[-SinkName] <string> [-LogName <string>] [-Severity {Default | Debug | Info | Notice | Warning | Error | Critical

| Alert | Emergency}] [-Before <DateTime>] [-After <DateTime>] [-Filter <string>] [<CommonParameters>]



Set-GcLogSink -BigQueryDataSetDestination <string> [-UniqueWriterIdentity <SwitchParameter>] [-Project <string>]

[-SinkName] <string> [-LogName <string>] [-Severity {Default | Debug | Info | Notice | Warning | Error | Critical

| Alert | Emergency}] [-Before <DateTime>] [-After <DateTime>] [-Filter <string>] [<CommonParameters>]



Set-GcLogSink -PubSubTopicDestination <string> [-UniqueWriterIdentity <SwitchParameter>] [-Project <string>]

[-SinkName] <string> [-LogName <string>] [-Severity {Default | Debug | Info | Notice | Warning | Error | Critical

| Alert | Emergency}] [-Before <DateTime>] [-After <DateTime>] [-Filter <string>] [<CommonParameters>]





DESCRIPTION

Updates properties of a log sink. If the sink does not exist, the cmdlet will create the sink. The cmdlet will use

the default project if -Project is not used.



There are 3 possible destinations for the sink: Google Cloud Storage bucket, Google BigQuery dataset and Google

Cloud PubSub topic. The destinations must be created and given appropriate permissions for log exporting (see

https://cloud.google.com/logging/docs/e ... horization) The cmdlet will not

create the destinations.





PARAMETERS

-GcsBucketDestination <string>

The name of the Google Cloud Storage bucket that the sink will export the log entries to.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-BigQueryDataSetDestination <string>

The name of the Google BigQuery dataset that the the sink will export the log entries to.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-PubSubTopicDestination <string>

The name of the Google PubSub topic that the the sink will export the log entries to.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-UniqueWriterIdentity <SwitchParameter>

Determines the kind of IAM identity returned as writerIdentity in the sink. If previously, the sink's writer

identity is cloud-logs service account, then the writer identity of the sink will now be changed to a unique

service account. If the sink already has a unique writer identity, then this has no effect. Note that if the

old sink has a unique writer identity, it will be an error to set this to false.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Project <string>

The project to create the sink in. If not set via PowerShell parameter processing, will default to the Cloud

SDK's DefaultProject property.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-SinkName <string>

The name of the sink to be created. This name must be unique within the project.



Required? true

Position? 0

Default value

Accept pipeline input? false

Accept wildcard characters? false



-LogName <string>

If specified, the cmdlet will filter out log entries that are in the log LogName.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Severity <LogSeverity>

If specified, the cmdlet will filter out log entries with the specified severity.



Possible values: Default, Debug, Info, Notice, Warning, Error, Critical, Alert, Emergency



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Before <DateTime>

If specified, the cmdlet will filter out log entries that occur before this datetime.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-After <DateTime>

If specified, the cmdlet will filter out log entries that occur after this datetime.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Filter <string>

If specified, the cmdlet will filter out log entries that satisfy the filter.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS



---------- EXAMPLE 1 ----------



PS C:\\> Set-GcLogSink -SinkName "my-sink" -GcsBucketDestination "my-bucket"



This command changes the destination of the sink name "my-sink" in the default project to "my-bucket".

---------- EXAMPLE 2 ----------



PS C:\\> Set-GcLogSink -SinkName "my-sink" -BigQueryDataSetDestination "my_dataset" -LogName "my-log" -Project

"my-project"



This command changes the destination of the sink name "my-sink" in the project "my-project" to the big query

dataset "my_dataset". The sink will now only export log from "my-log".

---------- EXAMPLE 3 ----------



PS C:\\> Set-GcLogSink -SinkName "my-sink" -Filter 'textPayload = "textPayload"' -UniqueWriterIdentity



This command updates the filter of the log sink "my-sink" to 'textPayload = "textPayload"' and updates the writer

identity of the log sink to a unique service account.



RELATED LINKS

[Log Sinks] (https://cloud.google.com/logging/docs/b ... epts#sinks)

[Exporting Logs] (https://cloud.google.com/logging/docs/e ... orted_logs)