regex - 如何在 Cloudwatch Events 上使用正则表达式
问题描述
在 Cloudwatch Event 中,我们可以编写关于源、详细信息等的过滤规则。我目前的做法如下所示,
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中还有另一个问题问类似的问题(for destination
),解决方法是使用单独的规则,似乎这也是source的唯一方法。
解决方案
截至目前,不支持正则表达式。您可以做的最大工作是使用complex filter
查看EventBridge
详细信息content-filtering-with-event-patterns。
另请参阅此 SO 问题中的答案,regex-in-cloudwatch-event-pattern-matching对我有帮助。
希望AWSRegEx matching
的家伙将来会添加!
推荐阅读
- protocol-buffers - nanopb oneof size requirements
- php - 无法使用 FPDF 和 php 下载 PDF 文件
- node-red - 使用红色节点从 modbus TCP 读取 32 位浮点数
- c++ - 将 Qt Undo 框架与 QPainter 一起使用
- factory-bot - FactoryBot:检查 trait 是否已传入
- xml - XSLT 变量没有返回任何值
- php - Facebook\WebDriver\Exception\NoSuchElementException:没有这样的元素:无法找到元素
- html - Chrome 审核 - 禁用按钮的对比度不足
- javascript - HTML5 视频:Canvas Mirror 慢
- python - 逐行连接两个相似的数据帧