< Back
New-GcLogMetric
Post
NAME New-GcLogMetric
SYNOPSIS
Creates a new log metric.
SYNTAX
New-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
Creates a new log metric. The metric will be created in the default project if -Project is not used. Will raise an
error if the metric already exists.
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:\\> New-GcLogMetric -MetricName "my-metric" -LogName "my-log"
This command creates a metric to count the number of log entries in log "my-log".
---------- EXAMPLE 2 ----------
PS C:\\> New-GcLogMetric -MetricName "my-metric" `
-ResourceType "gce_instance"
-After [DateTime]::Now().AddDays(1)
-Project "my-project"
This command creates a metric name "my-metric" in project "my-project" that counts every log entry of the resource
type "gce_instance" that is created from tomorrow.
---------- EXAMPLE 3 ----------
PS C:\\> New-GcLogMetric -MetricName "my-metric" -Filter 'textPayload = "textPayload"'
This command creates a metric name "my-metric" that counts every log entry that matches the provided filter.
RELATED LINKS
[Log Metrics] (https://cloud.google.com/logging/docs/v ... ed_metrics)
SYNOPSIS
Creates a new log metric.
SYNTAX
New-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
Creates a new log metric. The metric will be created in the default project if -Project is not used. Will raise an
error if the metric already exists.
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:\\> New-GcLogMetric -MetricName "my-metric" -LogName "my-log"
This command creates a metric to count the number of log entries in log "my-log".
---------- EXAMPLE 2 ----------
PS C:\\> New-GcLogMetric -MetricName "my-metric" `
-ResourceType "gce_instance"
-After [DateTime]::Now().AddDays(1)
-Project "my-project"
This command creates a metric name "my-metric" in project "my-project" that counts every log entry of the resource
type "gce_instance" that is created from tomorrow.
---------- EXAMPLE 3 ----------
PS C:\\> New-GcLogMetric -MetricName "my-metric" -Filter 'textPayload = "textPayload"'
This command creates a metric name "my-metric" that counts every log entry that matches the provided filter.
RELATED LINKS
[Log Metrics] (https://cloud.google.com/logging/docs/v ... ed_metrics)