Goal
Create a rule that sends only the events you want.Prerequisites
- An event type from the catalog.
- For a team rule, the Owner or Admin role.
Workflow
1
In Events, open Rules and choose New rule, or choose Create a rule on a catalog entry.
2
Name the rule and enter the event pattern, for example deploy.failed, storage.object.* or *.failed.
3
Optionally limit it to a project and add conditions on the event data.
4
Choose the target and fill in its fields.
5
Check the would-have-matched preview for the last 24 hours, then save.
6
Use Send a test event to try the target.
Event patterns
- An exact type: deploy.failed.
-
- stands for any characters: storage.object.* matches every object event, *.failed matches every failure, and * alone matches everything.
- A rule takes 1 to 100 patterns. Each must match at least one event in the catalog.
Filters
- Project: only events from one project.
- Subject: a subject kind, and up to 100 subject ids.
- Conditions on data, up to 20: is, is one of, starts with, has a value. The API also accepts ends with (suffix). A field path is dot-separated inside data, for example content_type.
- This is matching, not a query language: every condition must hold.
Filters in the API
Whose events a rule sees
- A personal rule matches events in your personal account. A team rule matches that team’s events.
- At delivery time StackShift checks that the rule’s owner can still read the event’s subject. If not, the delivery fails with You no longer have access (access_revoked) and is not retried.
- Rules created from stackshift.yaml show in Rules but can only be changed in the file.
Delivery guarantees
Each match is delivered at least once, in order per subject where possible. Deduplicate on the event id.Expected result
The rule is on and each matching event appears in Deliveries.
Related guides
Targets
Send a matched event to a webhook, a Function, a durable queue or waiting job, a hosted agent or Stackie, Slack, email or the dashboard, or an automation.
Retries, replay and the dead-letter list
Failed deliveries retry 8 times over about 2 days. After the eighth failure the delivery goes to the dead-letter list, the destination or rule is turned off, and the owner gets an email.
Events from the CLI and stackshift.yaml
List the catalog, tail live events, add a webhook and replay deliveries from the CLI, and declare rules in stackshift.yaml under spec.events.rules.