在 CloudWatch Insights 中,如何过滤掉没有解析值的日志条目?

In CloudWatch Insights, how do I filter out log entries that don't have a parsed value?

假设我有以下 Insights 查询

fields @timestamp, @message
| parse @message 'status=*" as status
| display @timestamp, status, @message

一些日志消息没有状态。我想过滤掉那些。我该怎么做?

您可以使用ispresent()函数:https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html

像这样:

fields @timestamp, @message
| parse @message 'status=*" as status
| display @timestamp, status, @message
| filter ispresent(status)