小编Hen*_*son的帖子

在 CloudWatch Insight 中搜索 WAF 日志的键/值对

因此,AWS Cloudfront WAF 日志将发送到 AWS Cloud Insights。如何搜索 httpRequest 数组的键/值对的随机放置?

示例日志如下所示:

httpRequest.headers.0.name  host
httpRequest.headers.0.value www.somedomain.com
httpRequest.headers.1.name  cache-control
httpRequest.headers.1.value no-cache
httpRequest.headers.2.name  pragma
httpRequest.headers.2.value no-cache
httpRequest.headers.3.name  accept
httpRequest.headers.3.value */*
httpRequest.headers.4.name  accept-encoding
httpRequest.headers.4.value gzip, deflate
httpRequest.headers.5.name  from
httpRequest.headers.5.value bingbot(at)microsoft.com
httpRequest.headers.6.name  user-agent
httpRequest.headers.6.value Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)
Run Code Online (Sandbox Code Playgroud)

因此,一个具有 2 个哈希值的 JSON 数组。该数组中的顺序是随机的。有时用户代理将在 1 或 3 或 X 中。如何搜索与“用户代理”的“名称”字段的值相对应的“值”字段的值?即:我想搜索“bingbot”,但让它特定于匹配“用户代理”。我知道我可以对 @message for 进行过滤bingbot,但这似乎很昂贵并且不具体/容易出现错误命中。

amazon-waf aws-cloudwatch-log-insights

4
推荐指数
1
解决办法
1915
查看次数