---
title: Manage detection rules
description: "Manage scheduled and streaming detection rules in Lakewatch: configure shared settings, control execution, find rules, and edit YAML."
canonical_url: https://docs.databricks.com/aws/en/lakewatch/detections/manage-detection-rules
---

# Manage detection rules

> [!NOTE]
> **Beta**
>
> Lakewatch is in [Beta](https://docs.databricks.com/aws/en/release-notes/release-types.md). Workspace admins can control access to this feature from the **Previews** page. See [ Manage workspace-level previews](https://docs.databricks.com/aws/en/admin/workspace-settings/manage-previews.md#workspace).

Use this page to configure settings shared by scheduled and streaming detection rules, find existing rules, and edit rule YAML. A rule's type determines its detection input and execution settings. For creation steps, see [Scheduled detection rules](https://docs.databricks.com/aws/en/lakewatch/detections/scheduled-detection-rules.md#create-a-scheduled-rule) or [Streaming detection rules](https://docs.databricks.com/aws/en/lakewatch/detections/streaming-detection-rules.md#create-a-streaming-rule).

## Limits

The default detection-rule quotas are 200 rules per schema and 2,000 rules per metastore. All rules within the same metastore count toward the metastore quota, regardless of schema.

## <a id="rule-configuration" />Configure common rule settings

When you create or edit a rule, use **Rule sections** to navigate the form. Both rule types have these fields in **Detection input**:

* **Folder**: The folder where the rule is stored. If more than one folder is available, select one. Access to the rule comes from the folder's permissions.
* **Rule name** (required): The rule's name. You can't change it after creation.
* **Description** (optional): A short description of the rule's purpose.

The form also has these controls:

* **Create with Genie**: On a new rule, opens a side panel where Genie helps you write and refine detection logic.
* **Edit as YAML**: Opens the YAML editor. See [Edit a rule as YAML](https://docs.databricks.com/aws/en/lakewatch/detections/manage-detection-rules.md#edit-a-rule-as-yaml).

## <a id="signals" />Configure signals

Use the **Signals** section to control alert generation and configure signal summaries and context. Scheduled rules also have deduplication settings.

### <a id="generate-alerts" />Generate alerts

To temporarily stop this rule's [signals](https://docs.databricks.com/aws/en/lakewatch/detections/signals.md) from opening [alerts](https://docs.databricks.com/aws/en/lakewatch/alerts/index.md), turn off **Generate alerts**. The rule continues to run and produce signals while alerts are suppressed. Suppression stops only new alerts: a signal that matches an alert that's already open still [attaches to it](https://docs.databricks.com/aws/en/lakewatch/alerts/index.md#how-are-alerts-created). Alert generation settings are unavailable when the rule is inactive, so keep the rule **Active**.

Use the following settings to set when alerts resume:

* **Suppress for**: Select a preset duration (1, 4, or 24 hours, or 3 or 7 days), which fills in **Suppress until**. To enter your own end time, select **Until a specific time**.
* **Suppress until** (required): The future date and time when alerts resume. Times use your local time zone and are stored as UTC.

To apply suppression, save the rule. In the rule list, the rule shows **Suppressed until** and the end time. Alerts resume automatically at that time. To resume alerts earlier, turn **Generate alerts** back on and save the rule.

### <a id="summary" />Signal summary

The signal summary is required. It describes the detected behavior and can appear as the alert title. Use SQL expressions in braces, `{sql-expression}`, to include event details. Scheduled rules read these values from the query result. Streaming rules read them from the source row. Signals that share a summary, rule ID, and version are grouped into one [alert](https://docs.databricks.com/aws/en/lakewatch/alerts/index.md#how-are-alerts-created). For scheduled rules, deduplication drops a duplicate signal when the entire output row matches within the deduplication window. To avoid creating an excessive number of alerts, keep the summary general and avoid field expansions that produce a unique value on every match, such as a timestamp or event ID.

For example, if the query result or source row contains `user.name`, use it in the summary:

```text
Brute force attempt detected for `{user.name}`
```

### <a id="context" />Context

The context field attaches structured metadata to the signal event as key-value pairs. Each key is a label and each value can include SQL expressions wrapped in curly braces `{sql-expression}` to insert event details. For example, a key of `source_ip` with a value of `{src_endpoint.ip}`.

Alternatively, turn on **Include all data** to automatically record all columns from the query result row (scheduled rules) or source row (streaming rules) that triggered the signal. Context is required unless **Include all data** is on.

### <a id="deduplication" />Deduplication

Deduplication settings apply only to scheduled rules. See [Configure scheduled-rule deduplication](https://docs.databricks.com/aws/en/lakewatch/detections/scheduled-detection-rules.md#deduplication). Streaming rules create a signal for every matching row.

## <a id="mitre-attck" />Map MITRE ATT\&CK techniques

Map the detection to the MITRE ATT\&CK framework for standardized threat categorization:

> MITRE ATT\&CK® is a globally-accessible knowledge base of adversary tactics and techniques based on real-world observations. The ATT\&CK knowledge base is used as a foundation for the development of specific threat models and methodologies in the private sector, in government, and in the cybersecurity product and service community.

If the detection maps to the [MITRE ATT\&CK](https://attack.mitre.org/) framework, complete the following fields to help analysts understand the threat context and enable better threat hunting:

Click **Add MITRE mapping** to create a mapping, then fill in these dropdowns. Add as many mappings as apply:

* **Taxonomy**: The MITRE ATT\&CK matrix, such as Enterprise.
* **Tactic**: The adversary's tactical goal.
* **Technique**: The method used to achieve the tactic.
* **Sub-technique**: A specific variation of the technique.

## <a id="metadata" />Set metadata

Set the rule's classification metadata. The following fields are required:

* **Severity**: An assessment of the severity of the threat, used to assign risk scores to signals. Values: `Informational`, `Low`, `Medium`, `High`, `Critical`.

* **Category**: A classification that describes the detection methodology. All Lakewatch workspaces include these default categories:

  * **Static Signature** - For rules matching exact patterns (e.g., known malware hashes)
  * **Fuzzy Signature** - For pattern matching with variation tolerance (e.g., similar phishing subjects)
  * **Behavioral** - For action-based detection (e.g., privilege escalation sequences)
  * **Statistical** - For threshold-based detection (e.g., unusual login volume)
  * **Learning (AI/ML)** - For ML-based detection (e.g., anomaly detection models)

  Custom categories are added in **Settings > Detection rules**, for each environment. Categories help organize rules, filter detections by methodology, and understand detection coverage.

* **Fidelity**: The maturity level of the rule. Newly created, untested rules should be marked as `Development` or `Investigative`. Older, well-tested rules should be marked as `High`. This helps analysts determine how likely a signal is a false positive. Values: `Development`, `Investigative`, `Medium`, `High`.

The following fields are optional:

* **Objective**: A longer description for detailed rule documentation. Include your reasoning for rule creation, testing methodology, and/or implementation notes.
* **Runbook**: Triage steps that analysts and the investigation agent use for the rule's alerts. This field supports Markdown.
* **Annotations (Key/Value pairs)**: An additional categorization method using a flexible tagging system for custom organization.

## <a id="execution" />Control rule execution

Use **Execution** to turn a rule on or off and select the identity it runs as. Scheduled rules also have [schedule settings](https://docs.databricks.com/aws/en/lakewatch/detections/scheduled-detection-rules.md#set-a-schedule). Streaming rules run continuously on compute that Lakewatch manages.

### <a id="active-state" />Turn a rule on or off

Use the **Active** switch to turn a rule on or off. New rules are active by default. A user with `MANAGE` can turn a rule on or off without permission to delegate to its run-as principal, provided the update makes no other changes. This keeps the existing run-as identity. Turning a rule on requires that the stored principal's delegation is valid and, for scheduled rules, that it has the required catalog access.

To temporarily suppress alerts without stopping a rule, use [Generate alerts](https://docs.databricks.com/aws/en/lakewatch/detections/manage-detection-rules.md#generate-alerts).

### <a id="run-as-principal" />Set the run-as principal

Select **Edit run as principal** to choose the user or service principal the rule runs as. The default is the rule's creator. The principal must have access to the tables the rule reads. You must have `MANAGE` on the rule to change its run-as principal. Editing detection logic or other configuration also requires permission to delegate to the run-as principal.

For scheduled rules, only the run-as principal and workspace admins can open the rule's job runs. See [Scheduled jobs and the run-as principal](https://docs.databricks.com/aws/en/lakewatch/admin/access-control/access-control-model.md#run-as-principal).

## <a id="find-rules" />Find rules in the list

The **Detection rules** page lists the rules in the current environment. To narrow the list, use **Search detection rules**, or filter by **Type**, **State**, **Severity**, **MITRE tactic**, **MITRE technique**, **Category**, or **Datasource**.

Use the **Datasource** filter to find the rules that depend on a datasource, for example before you change or delete it. It matches rules that query the datasource's tables and rules added from the Content library for the datasource's parsers. Lakewatch reads table names from each rule's SQL, so a rule that refers to a table only indirectly might not match.

## <a id="edit-rule" />Edit a rule

1. In **Detection rules**, open the rule.
2. Click **Edit rule**.
3. Update the rule's settings, then click **Save changes**. To discard your changes, click **Cancel**.

Lakewatch applies the saved configuration to the rule. You can't change its type. To use another type, create a new rule.

## <a id="edit-a-rule-as-yaml" />Edit a rule as YAML

The rule form includes an **Edit as YAML** button. The form and YAML editor stay in sync. Changes you make in YAML populate the form, and the YAML reflects the form values.

Both rule types use the common fields in the following table. For the detection input, schedule timing, and type-specific examples, see [Scheduled rule YAML](https://docs.databricks.com/aws/en/lakewatch/detections/scheduled-detection-rules.md#yaml) or [Streaming rule YAML](https://docs.databricks.com/aws/en/lakewatch/detections/streaming-detection-rules.md#yaml).

| YAML field                 | Wizard control   | Required | Notes                                                                                                                                                                 |
| -------------------------- | ---------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `catalog_name`             | Catalog          | Yes      | Can't be changed after the rule is created.                                                                                                                           |
| `schema_name`              | Schema           | Yes      | Can't be changed after the rule is created.                                                                                                                           |
| `rule_name`                | Name             | Yes      | Can't be changed after the rule is created.                                                                                                                           |
| `description`              | Description      | No       |                                                                                                                                                                       |
| `run_as_principal`         | Run-as identity  | No       | A user email or service principal application ID. Defaults to the rule's creator.                                                                                     |
| `severity`                 | Severity         | Yes      | One of `Informational`, `Low`, `Medium`, `High`, or `Critical`.                                                                                                       |
| `category`                 | Category         | Yes      | A category label, such as `Behavioral`.                                                                                                                               |
| `fidelity`                 | Fidelity         | Yes      | One of `FIDELITY_DEVELOPMENT`, `FIDELITY_INVESTIGATIVE`, `FIDELITY_MEDIUM`, or `FIDELITY_HIGH` (shown in the wizard as Development, Investigative, Medium, and High). |
| `objective`                | Objective        | No       |                                                                                                                                                                       |
| `mitre`                    | MITRE ATT\&CK    | No       | A list of mappings, each with `taxonomy`, `tactic`, `technique_id`, `technique`, `sub_technique_id`, and `sub_technique`.                                             |
| `output.summary`           | Signal summary   | Yes      | Supports `{sql-expression}` substitutions.                                                                                                                            |
| `output.context`           | Context          | Depends  | Required unless `output.default_context` is `true`. A key/value map. Values support `{sql-expression}` substitutions.                                                 |
| `output.default_context`   | Include all data | No       | When `true`, records every column of the triggering row.                                                                                                              |
| `output.event_time_column` | —                | No       | The column that holds the event timestamp. Scheduled rules use the query result, and streaming rules use the source row.                                              |
| `schedule.enabled`         | Active           | No       | Whether the rule is active. Defaults to `true`.                                                                                                                       |
| `suppress_until_time`      | Suppress until   | No       | A timestamp until which the rule's signals don't open alerts.                                                                                                         |
| `annotations`              | Annotations      | No       | A key/value map.                                                                                                                                                      |

## Additional resources

* [Choose a detection rule type](https://docs.databricks.com/aws/en/lakewatch/detections/choose-detection-rule-type.md)
* [Signals](https://docs.databricks.com/aws/en/lakewatch/detections/signals.md)
