如何在AWS Eventbridge Eventpattern中使用任何其他条款中使用多个前缀?

问题描述 投票:0回答:3
我有一个情况,我需要使用EventBridge中的EventPatterns过滤某些事件。 我想为所有事件运行规则,除了用户名以ABC或XYZ开头的规则。 我尝试了以下2个语法,但没有奏效:

"userIdentity": { "sessionContext": { "sessionIssuer": { "userName": [ { "anything-but": { "prefix": [ "abc-", "xyz-" ] } } ] } } } "userIdentity": { "sessionContext": { "sessionIssuer": { "userName": [ { "anything-but": [{ "prefix": "abc-", "prefix": "xyz-" }] } ] } } }
在保存规则时发现以下错误:
“

event模式是无效的。原因:除了列表外,启动| null |布尔值不支持。 我在语法中缺少某些内容,或者如果这是一个限制,那么该问题是否有其他选择?

您可以在事件模式中使用数组中的前缀。这是一个示例模式:

{ "detail": { "alarmName": [{ "prefix": "DemoApp1" }, { "prefix": "DemoApp2" } ], "state": { "value": [ "ALARM" ] }, "previousState": { "value": [ "OK" ] } } }
amazon-web-services amazon-cloudwatch serverless aws-event-bridge amazon-cloudwatch-events
3个回答
8
投票
demoApp1

demoapp2
开头的警报
    

TLDR:用户@samtoddler是正确的。 prefix仅适用于https://docs.aws.amazon.com/eventbridge/latest/userguide/content-filtering-with-with-event-patterns.html#filterwiltering-prefix-prefix-matchinging-中所调用的值。他们不使用阵列。您可以在AWS支持的情况下提交功能请求,但是如果您想解除自己的阻止;您最好控制用户名的前缀(猜想这与您的控制相关,并且在您的控制中)。

如果不可能;在发送到Compute(可能是Lambda)之前,请考虑通过其他属性进行过滤以进行其他过滤。

1
投票

{ "detail": { "lastStatus": ["STOPPED"], "stoppedReason": [{ "anything-but": { "prefix": ["Task stopped by user", "Scaling activity initiated"] } }] }, "detail-type": ["ECS Task State Change"], "source": ["aws.ecs"] }

这种配置有效。在the the the the the the the the the the the the the the the inthing in thepromixes节的文档中也有示例。

Https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-create-pattern-operators.html#eb-filtering-thing-anything but: 20prefixes


0
投票
	

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.