Import and export rules
Export rules to a file to back them up, to review them, or to move them to another appliance. Import reads the same file.
Role needed: An Admin or Super Admin account opens the Detection Rules screen. Exporting needs Settings access with Trigger Rules: Read. Importing needs Trigger Rules: Set. See Detection Rules.
Export rules
- Select Settings, then Detection Rules in the Detections group.
- Export one rule with Export rule in its row. Or tick several rules, select Bulk actions, then Export. On a rule's details page, use All actions, then Export rule.
The browser downloads a file named rules_export.ndjson. It holds one whole rule per line. A message confirms how many rules were exported.
Export covers rules that raise alerts only. A building-block rule is left out, and if everything you chose is a building block the console says Export covers rules that raise alerts. The file leaves out what an appliance works out for itself, such as when the rule was created and updated and its revision, so the file can be imported anywhere.
Import rules
- On the Detection Rules screen, select Import rules.
- In Import rules, select a file or drop one on the box. The file can be
.ndjsonor.json. - Decide whether to tick Overwrite existing rules with a conflicting "uid".
- Select Import.
The window closes when every rule imports. A message confirms how many, for example Imported 3 rules.
What the import does
| Detail | Behaviour |
|---|---|
| File | UTF-8 text up to 10 MB, with up to 5,000 rules. The file is one rule per line, or a JSON array of rules. |
| Checks | Each rule is checked as if you had saved it in the editor. A rule that fails is skipped and the others still import. |
| A rule that already exists | Skipped, unless you tick Overwrite existing rules with a conflicting "uid". An overwritten built-in rule stays a built-in rule. |
| Who the rule runs as | An imported scheduled rule runs as the account that imported it. See What a scheduled rule can see. |
| Enabled state | Each imported rule keeps the enabled state it was exported with. |
| An older export | A file from an older version, with one Trigger Rule per line, is converted on import. |
If some rules fail, the window stays open and says Imported 2 of 3 rules with a line for each problem, such as Line 2: a rule with this id already exists. It lists the first 10 and says how many more there are.
Check the imported rules before you rely on them. A rule refers to the Reference Lists, lookup files and tags it uses, so make sure the appliance you import into has them. Shared suppression lists are exported on their own. See Rule exceptions and the suppression list.