如何在Google Stackdriver日志中使过滤器“不包含”

问题描述 投票:1回答:3

在Google Stackdriver高级过滤器中,我可以插入如下内容:

resource.type="container"
resource.labels.cluster_name="mycluster"
textPayload!="Metric stackdriver_sink_successfully_sent_entry_count was not found in the cache."
severity="INFO"
textPayload:(helloworld)

最后一条规则意味着字段textPayload应包含字符串helloworld。但我无法找到添加NOT运算符的方法。

我会使用类似的东西:

textPayload:!(helloworld)

但不起作用

logging string-comparison google-cloud-stackdriver
3个回答
5
投票

只需在两行之间添加AND NOT:

resource.type="container"
resource.labels.cluster_name="mycluster"
textPayload!="Metric stackdriver_sink_successfully_sent_entry_count was not found in the cache."
severity="INFO" AND NOT
textPayload:(helloworld)

3
投票

如果要排除包含单词“unicorn”的条目,可以使用filter-text:unicorn

资料来源:https://cloud.google.com/logging/docs/view/basic-filters


0
投票

顺便说一句,有时候\n会结束。

您也可以单击日志,单击子条目和clik隐藏。

© www.soinside.com 2019 - 2024. All rights reserved.