首页 > 解决方案 > Logs Insights 中的 AWS CloudWatch 过滤器 @LogStream

问题描述

有没有办法只在小部件中过滤不包含特定日志消息的 @LogStream ?

我尝试使用带有一些过滤器的日志表,如: https ://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html 和: https ://docs.aws.amazon.com/AmazonCloudWatch /latest/logs/CWL_QuerySyntax.html#CWL_QuerySyntax-regex

据我了解,过滤器适用于消息,但我需要一种在日志流级别进行过滤和选择的方法。

尝试过这样的事情:

找到的字段 @logStream, strcontains(@logStream, "[INFO] - My message")

| 过滤器找到=0

| 显示@logStream

| 限制 20

但是过滤器不起作用,它正在显示所有消息。

谢谢!

标签: amazon-web-servicesamazon-cloudwatchaws-cloudwatch-log-insights

解决方案


您的strcontains(@logStream, "[INFO] - My message") as found部分查询对我来说看起来不正确。我认为你的意思是:strcontains(@message, "[INFO] - My message") as found


推荐阅读