Skip to content

gcp update-log-metric

Update log metric

Description

update log metric for gcp logs

Synopsis

gcp update-log-metric
    [--site <site>]
    [<name>]
    [--description <description>]
    [--filter <filter>]
    [--disabled]
    [--log_name <log_name>]
    [--severity <severity>]
    [--filter <filter>]
    [--start_time <start_time>]
    [--end_time <end_time>]

Arguments

site - (string)

     Site where this command will be executed
     Example: --site "site-1"
     Default: input.site      Attributes: optional

name - (string)

     Metric name to create metric
     Example: "CassandraMetric"
     Default: _None_      Attributes: optional

description - (string)

     Description for the metric
     Example: --description "Metric details for Cassandra"
     Default: _None_      Attributes: optional

filter - (string)

     A filter that chooses which log entries to create metric for
     Example: --filter "resource.type=gae_app AND severity>=ERROR"
     Default: _None_      Attributes: optional

disabled - (bool)

     If set to True, then this metric is disabled and it does not generate any points
     Example: --disabled
     Default: _None_      Attributes: optional

log_name - (string)

     log names to filter out the logs
     Example: --log_name "projects/macro-context-293714/logs/GCEGuestAgent"
     Default: _None_      Attributes: optional, multiple allowed

severity - (string)

     Severity of the logs
     Example: --severity "INFO"
     Default: _None_      Attributes: optional, multiple allowed

     Validation:
         allowed values: DEFAULT, DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY

filter - (string)

     A filter that chooses which log entries to return
     Example: --filter "resource.type=gae_app AND severity>=ERROR"
     Default: _None_      Attributes: optional

start_time - (time)

     The time stamp indicating the earliest data to be returned
     Example: --start_time "60m ago"
     Default: _None_      Attributes: optional

end_time - (time)

     The time stamp indicating the latest data to be returned
     Example: --end_time "now"
     Default: now      Attributes: optional

Examples

Input:

x=! gcp update-log-metric "testMetric3" --description "testDesc2" --filter "severity=\"INFO\""
Output:
{
  "metric": {
    "name": "testMetric3",
    "description": "testDesc2",
    "filter": "severity=\"INFO\"",
    "createTime": "2022-10-14T08:33:18.198693597Z",
    "updateTime": "2022-10-14T08:35:44.706415294Z"
  }
}
Input:
! gcp update-log-metric "testMetric2" --description "testDesc2" --filter "severity=\"INFO\""
Output:
NAME            DESCRIPTION     FILTER 
testMetric2     testDesc2       severity="INFO"

Access Control

To use this command, you need access to the following:

Field Value
Action "update"
Service Type "gcp"
Service Instance
Namespace
Object Type "metric"
Object ID name

Please see Access Control for details.