Configuring Mapping Rules
To provision mapping rules, follow these steps:- Set the
KEEP_MAPPINGS_DIRECTORYenvironment variable to the path of your mapping configuration directory. - Create one YAML manifest per mapping rule in that directory.
Manifest format
Each YAML manifest describes one mapping rule. Fields mirror the fields accepted by the RESTPOST /mapping endpoint:
| Field | Required | Notes |
|---|---|---|
name | yes | Lookup key — must be unique across the tenant |
description | no | Human-readable description |
priority | no | Integer, default 0. Higher = evaluated first |
type | no | csv (default) or topology |
matchers | yes | List of attribute groups. Within a list: AND. Between lists: OR |
rows | yes for csv | List of {key: value} dicts; rows match against incoming alert attributes |
is_multi_level | no | Default false |
new_property_name | no | Required if is_multi_level is true |
prefix_to_remove | no | Optional, used with multi-level mappings |
Update Provisioned Mapping Rules
On every restart, Keep reads theKEEP_MAPPINGS_DIRECTORY environment variable and determines which mapping rules need to be added, removed, or updated.
The high-level provisioning mechanism:
- Keep reads the
KEEP_MAPPINGS_DIRECTORYvalue. - Keep lists all
.yaml/.ymlfiles under the directory (other files are skipped). - For each manifest: lookup an existing rule by
name. If found, update it and markis_provisioned=True. If not, create a new provisioned rule. - Provisioned rules whose source file is no longer present in the directory are deprovisioned (deleted).
- UI-created rules (
is_provisioned=False) whose name does not appear in any manifest are untouched.
Adoption of existing UI rules
If a mapping rule already exists in the UI with the samename as one of your manifests, the next provisioning run adopts it: is_provisioned flips to True, the rule’s provisioned_file is recorded, and its content is overwritten from the manifest. The database id is preserved, so any external references to that rule (URLs, dashboards) continue to work.
Fields not present in the manifest schema (disabled, override, condition) are reset to their model defaults on adoption — the manifest is the source of truth, so a rule that was disabled via the UI will be re-enabled when adopted.
Removing all provisioned mapping rules
IfKEEP_MAPPINGS_DIRECTORY is unset on a Keep instance that previously had provisioned rules, all of them are deprovisioned (deleted) on the next restart. UI-only rules are unaffected.

