如何使用 ispresent() 函数过滤 CloudWatch Log Insights

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

我正在尝试对不是那么新的AWS Cloudwatch Log Insights

执行一个非常简单的查询

我正在按照他们的文档使用

ispresent
功能过滤我的日志。

查询如下:

fields @timestamp, status
| filter ispresent(status) != 0

但这给了我一个错误(超级没有帮助

We are having trouble understanding the query

如何通过仅显示带有

status
字段的日志来过滤日志?

amazon-cloudwatch aws-cloudwatch-log-insights
3个回答
59
投票

接受的答案对我不起作用,但你现在可以否定

ispresent()

fields @timestamp, status
| filter !ispresent(status)

24
投票

过了一会儿,我想出了如何以一种黑客的方式做到这一点。

fields @timestamp, status, ispresent(status) as exist
| filter exist != 0

不是最好的方法(并且它违背了他们的文档),但是有效。


0
投票

以下查询对我有用。

fields @timestamp, status
| filter isPresent(status)
© www.soinside.com 2019 - 2024. All rights reserved.