首页 > 解决方案 > CloudWatch Insights 过滤到仅包含查询字符串的主页请求

问题描述

我们的日志中有一个“url”字段,我希望能够过滤到仅请求访问主页。这将是对/和 for 的请求/?*,即使用任何查询字符串。

只是获取主页请求,| filter url = "/"但是如何包含那些也有查询字符串的请求呢?

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

解决方案


您可以使用正则表达式:https ://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html

像这样的东西应该工作:

filter url = "/" or url like /^\/\?.*/

推荐阅读