在 StackDriver Logging 中使用通配符

Tom*_*mmy 5 google-cloud-platform google-stackdriver

我想在 Google StackDriver 日志过滤器中使用通配符。但是,根据官方网站,过滤器无法使用它。有什么方法可以使用吗?

小智 8

如果要搜索文本中包含的字符串,只需直接键入该字符串即可。

Unicorn (text:Unicorn)
Finds all log entries containing unicorn, in any field and in any letter case.
Run Code Online (Sandbox Code Playgroud)

如果要在高级过滤器中添加条件以在所有以“前缀”开头的 pod 中进行搜索,请尝试如下操作(note ':' instead of '=')

resource.type="k8s_container"
resource.labels.cluster_name="cluster-1"
resource.labels.pod_name:"prefix"
Run Code Online (Sandbox Code Playgroud)


Sun*_*y J 3

您可以查看以下常见的基本搜索示例

例子:

字符串的用法如下: uni* (text:uni*)

如上述文档中所述“这不是通配符搜索。此搜索会查找包含 4 个字符字符串的所有日志条目"uni*"。日志查看器不支持正则表达式搜索,并且没有特殊的通配符,例如 * 或 ?,基本或高级过滤器接口”。

您还可以使用问题跟踪器将其作为功能请求提交。