gcp get-log-metric
Get log metric
Description
Get log metric for gcp logs
Synopsis
Arguments
site
- (string)
Site where this command will be executed
Example: --site "site-1"
Default: input.site
Attributes: optional
name
- (string)
Metric name to fetch metric
Example: "CassandraMetric"
Default: _None_
Attributes: optional
Examples
Input:
Output:{
"metric": [
{
"name": "testMetric1",
"filter": "severity=\"INFO\"",
"metricDescriptor": {
"name": "projects/macro-context-293714/metricDescriptors/logging.googleapis.com/user/testMetric1",
"type": "logging.googleapis.com/user/testMetric1",
"metricKind": "DELTA",
"valueType": "INT64",
"unit": "1"
},
"createTime": "2022-10-12T10:48:23.869119110Z",
"updateTime": "2022-10-12T10:48:23.869119110Z"
},
{
"name": "testMetric2",
"description": "testDesc2",
"filter": "severity=\"INFO\"",
"metricDescriptor": {
"name": "projects/macro-context-293714/metricDescriptors/logging.googleapis.com/user/testMetric2",
"type": "logging.googleapis.com/user/testMetric2",
"metricKind": "DELTA",
"valueType": "INT64",
"unit": "1",
"description": "testDesc2"
},
"createTime": "2022-10-12T13:33:38.884929622Z",
"updateTime": "2022-10-12T14:00:28.715224167Z"
},
{
"name": "testMetric3",
"description": "testDesc2",
"filter": "severity=\"INFO\"",
"metricDescriptor": {
"name": "projects/macro-context-293714/metricDescriptors/logging.googleapis.com/user/testMetric3",
"type": "logging.googleapis.com/user/testMetric3",
"metricKind": "DELTA",
"valueType": "INT64",
"unit": "1",
"description": "testDesc2"
},
"createTime": "2022-10-14T08:33:18.198693597Z",
"updateTime": "2022-10-14T08:35:44.706415294Z"
}
]
}
NAME DESCRIPTION FILTER TYPE
testMetric1 testDesc2 severity="INFO" logging.googleapis.com/user/testMetric1
testMetric2 testDesc2 severity="INFO" logging.googleapis.com/user/testMetric2
testMetric3 testDesc severity="INFO" logging.googleapis.com/user/testMetric3
testMetric4 testDesc protoPayload.status >= 400 AND sample(insertId, 0.1) logging.googleapis.com/user/testMetric4
testMetric5 - protoPayload.status >= 400 AND sample(insertId, 0.1) logging.googleapis.com/user/testMetric5
NAME DESCRIPTION FILTER TYPE
testMetric1 testDesc2 severity="INFO" logging.googleapis.com/user/testMetric1
{
"buckets": [
{
"name": "prabhsimran-bucket-1",
"created": "2022-10-28T06:35:42.135Z",
"labels": {
"owner": "prabhsimran",
"use": "testing"
},
"location": "US",
"etag": "CAE="
},
{
"name": "prabhsimran-bucket-2",
"created": "2022-10-28T06:36:14.403Z",
"location": "US",
"etag": "CAE="
}
]
}
{
"objects": [
{
"name": "testobject-1",
"created": "2022-10-28T06:56:02.183Z",
"updated": "2022-10-28T06:56:02.183Z",
"deleted": "0001-01-01T00:00:00Z",
"etag": "CLTs54GsgvsCEAE=",
"bucket": "prabhsimran-bucket-1",
"size": "9",
"contentType": "text/plain; charset=utf-8"
}
]
}
NAME BUCKET SIZE CREATED UPDATED DELETED
testobject-1 prabhsimran-bucket-1 9 2022-10-28T06:56:02.183Z 2022-10-28T06:56:02.183Z 0001-01-01T00:00:00Z
{
"instances": [
{
"name": "test-instance-1",
"created": "2022-10-28T00:26:21.770-07:00",
"status": "RUNNING",
"zone": "https://www.googleapis.com/compute/v1/projects/prabhsimran-project/zones/us-central1-a",
"machineType": "https://www.googleapis.com/compute/v1/projects/prabhsimran-project/zones/us-central1-a/machineTypes/f1-micro"
}
]
}
NAME CREATED STATUS ZONE MACHINE TYPE
test-instance-1 2022-10-28T00:26:21.770-07:00 TERMINATED https://www.googleapis.com/compute/v1/projects/prabhsimran-project/zones/us-central1-a https://www.googleapis.com/compute/v1/projects/prabhsimran-project/zones/us-central1-a/machineTypes/f1-micro
Access Control
To use this command, you need access to the following:
Field | Value |
---|---|
Action | "read" |
Service Type | "gcp" |
Service Instance | |
Namespace | |
Object Type | "metric" |
Object ID | name |
Please see Access Control for details.