I am trying to find a way to somehow capture events that do not match a specific rule from an event bus. Below is the event-pattern for a rule that I created:
{
"detail": {
"key1": ["1234"],
"key2": ["ABC"],
"key3": ["PHL"]
}
}
The rule is matched and the target is invoked only if all 3 keys in the pattern are matching.
How do I log or find out the event that was unmatched by this rule and the target wasn't invoked?
Solutions I tried but failed:
- The dead-letter(DLQ) only captures events that fail due to technical reasons like target resource being down or IAM policy issues.
- Tried writing the inverse rule using "anything-but" clause but doesn't work if any one key mismatch occurs. Only works if all 3 keys mismatch. (Details here: EventBridge rule "anything-but" pattern)
- Tried the solution in the below AWS documentation link but I couldn't find the "FailedInvocations" metric anywhere. Also, I'm not sure if that will help with unmatched events: https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-troubleshooting.html#eb-create-alarm-broken-event-rules