简体   繁体   中英

In GCP, How to create a logs-based metric from logs in a different bucket?

The new GCP Logs Viewer allows me to "Refine Scope" to a specific Logs Bucket: 在此处输入图像描述

However, if I try to do Actions->Create Metric it opens a new browser tab to Classic Logs Viewer, and I lose the original Scope context, so now it's looking at logs from the _Default bucket which is not what I want. 在此处输入图像描述

Discussed this with Google Cloud support person and they confirmed that at the time of this writing Metric Editor can only read logs from the _Default Log Storage Bucket.

So for now I'll route Logs to _Default and change to my preferred Log Storage Bucket when Metric Editor gets updated.

Even though it is still in alpha, the functionality of creating a log-based-metric on log buckets now available in GCP log-based-metrics page .

For now, it is only doable via CLI and here is it command:

gcloud alpha logging metrics create METRIC_NAME \
      --description="METRIC_DESCRIPTION" \
      --log-filter="FILTER" \
      --bucket_name=BUCKET_NAME

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM