【问题标题】:How to use regex on Cloudwatch Events如何在 Cloudwatch Events 上使用正则表达式
【发布时间】:2021-03-12 02:50:40
【问题描述】:

在 Cloudwatch 事件中,我们可以在源、详细信息等方面编写过滤规则。我目前的做法是 如下图,

  DefaultEventsRule:
    Type: AWS::Events::Rule
    Properties:
      Name: "CloudWatchRule1"
      Description: "Match events and send them to corresponding queue for delivery."
      EventPattern:
        {
          "source": ["xyz"],
          "resources":
              ...

是否可以对该source 进行正则表达式操作? 看起来不可能在事件上编写正则表达式; SO中还有另一个问题提出了类似的问题(destination),解决方法是使用单独的规则,这似乎也是获取源代码的唯一方法。

参考:regex-in-cloudwatch-event-pattern-matching

【问题讨论】:

    标签: regex amazon-web-services events filter amazon-cloudwatch


    【解决方案1】:

    目前不支持 RegEx。您最多可以使用complex filterEventBridge 详情见content-filtering-with-event-patterns

    另请参阅此 SO 问题中的答案,regex-in-cloudwatch-event-pattern-matching 这对我有帮助。

    希望 AWS 大佬以后能添加RegEx matching

    【讨论】:

      猜你喜欢
      • 2018-03-23
      • 2016-05-30
      • 1970-01-01
      • 2022-10-07
      • 1970-01-01
      • 2020-09-14
      • 2016-08-14
      相关资源
      最近更新 更多