<@ULVA73B9P> Is there a way to exclude one flow fr...
# marvin-ai
l
@Marvin Is there a way to exclude one flow from the slack alert automation, here is the config i have:
Copy code
{
  "type": "event",
  "match": {
    "prefect.resource.id": "prefect.flow-run.*"
  },
  "match_related": {},
  "after": [],
  "expect": [
    "prefect.flow-run.Failed",
    "prefect.flow-run.TimedOut",
    "prefect.flow-run.Crashed"
  ],
  "for_each": [
    "prefect.resource.id"
  ],
  "posture": "Reactive",
  "threshold": 1,
  "within": 0
}
m
thought for 138.5 seconds
Yes — you can exclude a specific flow by adding a negated filter in
match_related
. In Prefect 3.x Automations,
match
targets the primary resource (your flow run), and
match_related
lets you filter on related resources like the flow or deployment. Negation is supported with a leading
!
, and wildcards
*
are allowed. Two common ways to exclude a single flow: - Exclude by flow name (recommended if the name is stable):
Copy code
{
  "type": "event",
  "match": {
    "prefect.resource.id": "prefect.flow-run.*"
  },
  "match_related": {
    "prefect.resource.role": "flow",
    "prefect.resource.name": "!your-flow-name"
  },
  "after": [],
  "expect": [
    "prefect.flow-run.Failed",
    "prefect.flow-run.TimedOut",
    "prefect.flow-run.Crashed"
  ],
  "for_each": [
    "prefect.resource.id"
  ],
  "posture": "Reactive",
  "threshold": 1,
  "within": 0
}
- Exclude by flow ID (most precise):
Copy code
{
  "type": "event",
  "match": {
    "prefect.resource.id": "prefect.flow-run.*"
  },
  "match_related": {
    "prefect.resource.role": "flow",
    "prefect.resource.id": "!prefect.flow.<your-flow-uuid>"
  },
  "after": [],
  "expect": [
    "prefect.flow-run.Failed",
    "prefect.flow-run.TimedOut",
    "prefect.flow-run.Crashed"
  ],
  "for_each": [
    "prefect.resource.id"
  ],
  "posture": "Reactive",
  "threshold": 1,
  "within": 0
}
Notes: - You can exclude multiple flows with a list, e.g.
"prefect.resource.name": ["!flow-a", "!flow-b"]
. - If you prefer pattern-based exclusion, wildcards work, e.g.
"prefect.resource.name": "!staging-*"
. If you’re not sure of the exact labels on your events, open the Event Feed in the UI and inspect a sample flow-run event to confirm the
prefect.resource.*
fields for the related “flow” resource.