gpt4 book ai didi

amazon-web-services - AWS Cloudwatch 过滤器和模式语法

转载 作者:行者123 更新时间:2023-12-04 08:18:04 25 4
gpt4 key购买 nike

我正在按照此处的说明操作 https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html

但它并没有像我期望的那样工作。

我目前有以下 cloudwatch 日志订阅过滤器模式:? "UNKNOWN_TOPIC_OR_PARTITION" ? " SEVERE " ? " severe " ? " FATAL " ? " fatal " - "closing session"
我想将任何模式与“致命”匹配,同时从结果中排除“结束 session ”。

但是,上述过滤器匹配其他日志输出:

enter image description here

最佳答案

您不能在 CloudWatch 中使用事件过滤器...但您可以使用 日志洞察
CloudWatch -> CloudWatch 日志 -> 日志洞察
或者
CloudWatch -> CloudWatch Logs -> 日志组 -> [您的服务日志] -> [按钮日志见解]
日志洞察
Logs Insights UI

  • 日志服务(您需要选择您的服务将跟踪哪些日志
  • 在这部分您可以选择时间范围。
  • 在这里你有你的查询框,在这里你可以像 SQL 一样放置查询

  • 因此,在您的情况下,您可以在查询框中使用它
    fields @timestamp, @message
    | sort @timestamp desc
    | filter @message like /SEVERE|severe|FATAL|fatal|closing session/
    现在单击运行查询,您将只看到您想要使用该过滤器的日志。

    关于amazon-web-services - AWS Cloudwatch 过滤器和模式语法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56239820/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com