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

时间:2020-03-30 20:22:15

标签: amazon-cloudwatch aws-cloudwatch-log-insights

假设我有以下Insights查询

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

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

1 个答案:

答案 0 :(得分:1)

您可以使用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)