< Back

Set-GcLogMetric

Mon Jan 13, 2020 11:51 pm

NAME Set-GcLogMetric



SYNOPSIS

Updates a log metric.





SYNTAX

Set-GcLogMetric [-Project <string>] [-MetricName] <string> [[-Description] <string>] [-LogName <string>]

[-Severity {Default | Debug | Info | Notice | Warning | Error | Critical | Alert | Emergency}] [-Before

<DateTime>] [-After <DateTime>] [-Filter <string>] [<CommonParameters>]





DESCRIPTION

Updates a log metric. The cmdlet will create the metric if it does not exist. The default project will be used to

search for the metric if -Project is not used.





PARAMETERS

-Project <string>

The project to create the metrics 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



-MetricName <string>

The name of the metric. This name must be unique within the project.



Required? true

Position? 0

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Description <string>

The description of the metric.



Required? false

Position? 1

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-GcLogMetric -MetricName "my-metric" -LogName "my-log"



This command updates the metric "my-metric" to count the number of log entries in log "my-log".

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



PS C:\\> Set-GcLogMetric -MetricName "my-metric" `

-ResourceType "gce_instance"

-After [DateTime]::Now().AddDays(1)

-Project "my-project"



This command updates the metric name "my-metric" in project "my-project" to count every log entry of the resource

type "gce_instance" that is created from tomorrow.

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



PS C:\\> Set-GcLogMetric -MetricName "my-metric" -Filter 'textPayload = "textPayload"'



This command updates the metric name "my-metric" to count every log entry that matches the provided filter.



RELATED LINKS

[Log Metrics] (https://cloud.google.com/logging/docs/v ... ed_metrics)