【问题标题】:How to write AWS Log Insights query for multiple string patterns如何为多个字符串模式编写 AWS Log Insights 查询
【发布时间】:2022-08-04 07:58:04
【问题描述】:

我想编写一个日志洞察查询来搜索日志组中的多个字符串模式。

我知道我可以使用以下查询在日志中查找特定字符串:

 fields @timestamp, @message
| filter @message like \"test string\"
| sort @timestamp desc

但是,我想扩展它以使用正则表达式查找多个字符串模式。

有人可以帮助了解如何实现这一目标。我尝试在互联网上查看并阅读 aws 文档,但不知道该怎么做。

  • 您要过滤的任何特定模式?
  • @OmarRosadio 我正在尝试对 log4jshell 问题进行违规监控.. 所以寻找类似的模式:jndi: 等

标签: amazon-web-services amazon-cloudwatch amazon-cloudwatchlogs


【解决方案1】:

如何使用斜杠而不是引号。搜索正则表达式模式:

fields @timestamp, @message
| filter @message like /test string/
| sort @timestamp desc

https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/CWL_QuerySyntax.html

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-22
    • 2014-06-16
    • 2015-08-05
    • 2015-02-09
    • 2022-01-10
    • 2017-09-19
    相关资源
    最近更新 更多