如何使用MQL构建查询以从基于日志的度量中获取数据?

huangapple go评论43阅读模式
英文:

How do I build a query using MQL to fetch data from Log based metric?

问题

我有一个基于日志的指标,其中未定义资源类型。如何为以下日志基准指标构建 MQL 查询:

logging.googleapis.com/user/MY_METRIC

如果我在 Metric Explorer 中使用“配置视图”,数据会显示。然而,当我切换到 MQL 时,似乎无法创建正确的过滤器。

fetch logging.googleapis.com/user/MY_METRIC 给出了资源类型未定义的语法错误。

英文:

I have a log based metric where the resource type is not defined. How do I build a MQL query for a log based metric for the following:

logging.googleapis.com/user/MY_METRIC

If I use the "configuration view" in Metric Explorer the data shows. However when I switch to MQL I can't seem to create the correct filter.

fetch logging.googleapis.com/user/MY_METRIC gives me syntax errors for resource type not defined.

答案1

得分: 0

如果日志来自虚拟机,则必须选择资源类型为计算。

资源类型必须声明。

英文:

If the logs come from a VM then the resource type must be selected as compute.

Resource type must be declared.

答案2

得分: 0

我在我的环境中进行了测试并检查,在MQL中必须提供资源类型。这将起作用。

英文:

I have tested in my environment and checked it is mandatory to give the resource type in MQL. This will work.

huangapple
  • 本文由 发表于 2023年2月19日 00:20:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/75494681.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定