Edit rules in the Rules Editor
In Google Security Operations, build, test, and manage YARA-L detection rules using the split-view editor on the Rules tab or the Rules Editor tab.
To open the editor, select Detection > Rules & Detections from the navigation bar and choose one of the following views:
- Unified Rules tab (default): Click any rule row or click Create Rule to open the inline split-view editor.
- Standalone Rules Editor tab (legacy experience): Click Switch to the legacy experience, and then click the Rules Editor tab.
Rules Editor overview
The unified split-view editor and the standalone Rules Editor tab share the same YARA-L code editor and Test results panel, with different layouts for controls.
Unified split-view editor
When you select a rule or click Create Rule on the unified Rules tab, a split-view panel opens beside a compact rules list. Click Close split view to return to the full table.
The split-view header shows Status, Created, Last Updated, Rule Type, Archived (for archived rules), and the more_vert rule settings menu. Below the header, the panel includes the following tabs:
| Tab | Description |
|---|---|
| Overview | Displays rule metadata (Description, Author, Severity, Rule type, Created, and Updated). It also includes Status controls (Detecting and Alerting, plus Archived and Scope for custom rules) and Tags with Assign Tags (disabled for curated rules). |
| Logic | Contains the YARA-L code editor, compilation status, Rule writing help, Wrap Text, Discard, Save or Save as New, and the Test results panel. For curated rules, the editor toolbar is hidden. A read-only banner prompts you to duplicate the rule to make changes. |
| Detections | Displays detections generated by the rule with search, a time range selector (defaulting to the last 7 days), Columns, and Wrap Text. |
| Rule schedule | Displays and lets you configure the rule's run schedule. Non-customizable rules (such as single-event curated rules) display a read-only schedule notice. |
Rules list (standalone Rules Editor)
On the standalone Rules Editor tab, the collapsible rules list pane shows the rule count for active filters and matching search results. Selecting a rule loads its logic and metadata into the editor.
The rules list pane includes the following controls and sections:
| Element | Description |
|---|---|
| sort Sort | Sorts the rules list by Name (A - Z), Name (Z - A), or Last Updated. |
| filter_alt Filter | Filters the list to Show Active Rules, Show Archived Rules, or both. In the earlier legacy editor, these options are labeled Show All, Active Rules, and Archived Rules. |
| add Create a new rule | Opens a new rule template in the editor (icon-only button, labeled New in the earlier legacy editor). |
| Search | Filters the rules list by rule name (placeholder Search rules... in the earlier legacy editor). |
| Reference Lists | Displays reference lists used by the selected rule. Click an item to open its details, or use View and Open in the earlier legacy editor. |
| Data Tables | Displays data tables used by the selected rule. Click an item to view its contents, or use View and Open in the earlier legacy editor. |
Rule information header (standalone Rules Editor)
The standalone Rules Editor top bar displays Rules Capacity and View Rule Detections (for saved rules). Below the top bar, the rule information header includes the following metadata and controls:
| Element | Description |
|---|---|
| Rule name | Displays the rule's name. |
| Compilation status icon | Indicates whether the rule compiled cleanly, with warnings, or with errors. Click the icon when warnings or errors appear to view diagnostic messages. |
| Status | Displays the current state of the rule (Enabled, Disabled, Limited, Paused, or Archived). |
| Created | Displays when the rule was originally created. |
| Last Updated | Displays the relative time of the last update (labeled Last Saved in the earlier legacy editor). Click the timestamp on a custom rule to open its version history. |
| Archived | Archived rules only. Displays when the rule was archived. |
| Rule Type | Indicates whether the rule is Single Event, Multi Event (or Multiple Events), or Composite. |
| Detecting | Saved custom rules only. Turns live rule evaluation on or off. |
| Alerting | Saved custom rules only. Turns alert generation on or off. |
| Wrap Text | Turns line wrapping on or off in the code editor. |
| Data scope menu | Assigns a data access scope (displays Unscoped or Please select scope, or Bind to Scope in the earlier legacy editor). |
| more_vert Rule settings menu | Opens additional rule management options. |
| Toolbar | Includes Save and Discard while editing (alongside You have unsaved changes), and Promote when viewing a previous version. Save as New appears for new rules (labeled Save New Rule in the earlier legacy editor) and in version mode. Press Control+S (or Command+S on macOS) to save. |
Metadata, Detecting, Alerting, and the rule settings menu are hidden while you edit a rule or create a new rule.
YARA-L editor
The code editor is where you write and edit YARA-L 2.0 rules. The editor includes autocomplete to suggest valid YARA-L syntax as you write. For more information about YARA-L 2.0 syntax, see Get started with YARA-L.
A rule includes the following sections:
| Section | Description |
|---|---|
meta |
Contains descriptive attributes, such as the author, description, severity, and MITRE ATT&CK mapping. |
events |
Defines the event variables, filters, and predicates to evaluate. |
match |
Required for multi-event rules. Specifies the variables and time window used to group events. |
outcome |
Optional. Defines outcome variables, such as $risk_score or context arrays, captured with each detection. |
condition |
Specifies the Boolean condition over event and placeholder variables that triggers a detection. |
options |
Optional. Configures rule evaluation options, such as suppression_window. |
Test results panel
The Test results panel (Test Rule Results in the earlier legacy editor) lets you test a rule against historical events without saving detections or generating alerts:
| Control | Description |
|---|---|
| Time range to test | Sets the start and end timestamps for the test run, defaulting to the last 12 hours. The maximum range is 14 days for standard rules (90 days for metric-only rules). The selected range can't be shorter than the rule's match window. |
| Test | Starts a test run against the selected time range (labeled Run Test in the earlier legacy editor). |
| Cancel | Stops a running test (labeled Cancel Test in the earlier legacy editor). |
| Detections | Displays the number of test detections and a table of matching events. You can search results, click view_column Columns to customize columns, or click Wrap Text (changes to Unwrap Text). Click more_vert More options to select Download as CSV or Download as CSV (with raw logs). |
Create a new rule
Rules use the YARA-L 2.0 query language. Before creating a new rule for the first time, see Get started with YARA-L and Apply YARA-L 2.0 rule best practices.
To create a new rule, follow these steps:
On the unified Rules tab, click Create Rule to open a new rule template on the split-view Logic tab. On the standalone Rules Editor tab, click add Create a new rule (or New in the earlier legacy editor).
Write your rule logic in the YARA-L editor.
Optional: Configure the following settings:
Setting Description Wrap Text Select Wrap Text to prevent horizontal scrolling of long lines of code. Data scope menu Select a scope from the scope menu before saving (on the Rules Editor tab or on the split-view Overview tab). Scoped data RBAC users must select a scope before saving. In the unified split view, you can also update Scope on the Overview tab after saving. For more information, see Data RBAC impact on features overview. Click Save as New (Save New Rule in the earlier legacy editor), or click Discard to delete the unsaved draft.
Google SecOps checks the syntax of your rule. If the syntax is valid, the system saves the rule in a disabled state. If the syntax is invalid, an error message appears. To start evaluating live data, turn on Detecting after saving (on the split-view Overview tab or in the Rules Editor). For more information, see Apply a rule to live data.
The system automatically sets the run frequency for multi-event rules based on the match window size:
Match window Run frequency Under 60 minutes 10 minutes by default (customizable to 1 hour) 1 hour to 48 hours 1 hour Greater than 48 hours match_window / 10(up to 24 hours)For more information, see Understand rule run scheduling.
Edit a rule
To edit an existing custom rule, follow these steps:
On the unified Rules tab or the Rules Editor tab, browse, search, or filter to find the custom rule. For more information, see Search and filter rules.
Click the rule to open it in the split-view panel (select the Logic tab to edit YARA-L code) or in the Rules Editor.
Edit the YARA-L rule logic in the code editor, or update rule controls. In the unified split view, Detecting, Alerting, Archived, Scope, and Assign Tags appear on the Overview tab. Changes to these controls take effect immediately on saved rules. On the standalone Rules Editor tab, Detecting and Alerting appear in the header when you aren't editing code. You can configure the following controls:
Control Description Detecting Turn on to evaluate incoming log data and generate detections in real time, or turn off to stop running the rule. For more information, see Apply a rule to live data. Alerting Turn on to flag detections as Google SecOps alerts and trigger configured notifications or SOAR playbooks. Turn off to record detections without generating alerts. For more information, see Manage alerts and IOC matches. Wrap Text Select Wrap Text to prevent horizontal scrolling of long lines of code. Data scope menu Select a data access scope from the scope menu. For more information about adding a scope to a rule, see Data RBAC impact on features overview. Optional: On a saved rule, click more_vert (rule settings menu) to select options such as the following:
Option Description Rule schedule or Run Frequency View or configure how often the rule runs. For more information, see Understand rule run scheduling and Configure customized schedules for rules. Retrohunt Run the rule against historical log data over a specified time range to find past occurrences of a threat. For more information, see Run a rule against historical data. Duplicate Rule Create a copy of the rule. View Versions View previous versions of the rule, compare changes, or restore an earlier version. For more information, see View rule versions. View Rule Detections Open the Detections page to inspect detections generated by this rule, trend graphs, and underlying event details. For more information, see View rule detections. Archive or Unarchive Hide the rule from the default dashboard view without deleting its data, or restore an archived rule. For more information, see Archive rules. If you edited rule logic (or scope in the Rules Editor), click Save to save changes, or click Discard to revert them.
Search and filter rules
On the unified Rules tab (default experience), use the quick filters (Alerting, Detecting, Rule Owner, Archived, and Execution State) to narrow the list. By default, Archived is set to Active. Depending on screen width and whether split view is open, additional filters appear under the + Filters menu (such as +2 Filters or +5 Filters). You can also enter a query in the Search and press enter... field and press Enter. The search field supports the following methods:
| Search type | Description |
|---|---|
| Keyword search | Enter keywords to search across all rule text. |
| Structured search | Use field filters and operators to build precise queries. Supported fields include display_name, text, tags, rule_owner, live_mode_enabled, and alerting_enabled. |
For example, you can run these queries:
display_name:"My Rule"text:"malware"rule_owner:"GOOGLE" AND tags:"TA0001"live_mode_enabled=true AND alerting_enabled=true
For more information about search syntax, supported fields, and operators, see Search the rules list.
On the legacy Rules Dashboard tab, use the Search rules... field to match text in rule names. Quick filters and structured search queries are available only on the unified Rules tab.
On the Rules Editor tab (legacy experience), use the search field to filter by rule name. To filter by status, click filter_alt and select Show Active Rules, Show Archived Rules, or both. In the earlier legacy editor, these options are labeled Show All, Active Rules, and Archived Rules.
View rule detections
The Detections page displays a rule's metadata, a trend graph of recent detections, and a detailed list of underlying events.
To open a rule's detections view, follow these steps:
Find the rule on the unified Rules tab or the Rules Editor tab. For more information, see Search and filter rules.
Open the detections view using one of the following methods:
- To open a quick list of detections, click a rule row on the unified Rules tab and select the split-view Detections tab.
- To open the full Detections page, select View Rule Detections from the more_vert rule settings menu or the Rules Editor top bar.
Rule metadata
The top of the Detections page displays the following rule metadata:
| Field | Description |
|---|---|
| Rule name | Display name of the rule. |
| Last Saved | Date and relative time when the rule was last updated (hidden for archived rules). For custom rules, click the timestamp to open version history. |
| Rule ID | Unique system identifier for the rule. |
| Metadata fields | All meta attributes defined in the rule, such as Description, Author, and Severity. |
| Status | Custom rules only. Current operational state (Enabled, Disabled, Limited, or Paused). Archived rules display a warning banner at the top of the page. |
| Created | Custom rules only. Date when the rule was originally created. |
| Rule Type | Custom rules only. Structure of the rule logic (Single Event, Multiple Events, or Composite). |
| Rule Exclusions | Custom rules only. Exclusions applied to the rule, when configured. |
| Curated rule details | Curated rules only. CURATED DETECTION badge, Rule set link, and Rule set created date. |
Detection Count graph
The Detection Count graph displays the number of detections found by the rule over recent days:
| Indicator | Description |
|---|---|
| Shown Matches | Light gray bars represent detections matched by the rule. |
| Rule Runs | Blue underlines represent the time intervals of rule runs. |
| Run Errors | Red underlines represent errors that occurred during a rule run. |
For custom rules, click Retrohunt in the graph header to view or cancel retrohunts for this rule version (or start one if none exist). Click Reset time range to clear a zoomed range.
Detections list and controls
Below the graph, the Detections list shows individual events detected by the rule. You can use the following controls:
| Control | Description |
|---|---|
| Search | Narrows the detections list. |
| Event row | Opens the associated raw log or Unified Data Model (UDM) event when selected. |
| view_column Columns | Customizes displayed columns using common log attributes (such as hostname and user) or specific UDM fields. For more information, see Unified Data Model field list. |
| Wrap Text | Prevents horizontal scrolling of long lines of text (changes to Unwrap Text). |
| more_vert More options | Lets you select Download as CSV or Download as CSV (with raw logs). |
| Rule Options | Lets you open the editor or manage live status, alerting, schedules, retrohunts, versions, exclusions, and archiving for custom rules. For curated rules, this menu lets you select View and edit rule set and applicable options. It's hidden for archived rules and earlier versions. For more information, see Rule actions. |
| Procedural filtering panel | Lets you filter data to include or exclude specific information. For more information, see Procedural filtering overview. |
Rule actions
Manage rules using Rule Options on the Detections page, the more_vert rule settings menu, the split-view Overview tab, or the bulk Actions menu. The following table summarizes actions across these views:
| Action | Description |
|---|---|
| Detecting, Live Rule, or Live Status | Turn on to evaluate incoming log data in real time, or turn off to stop running the rule. Depending on performance, the rule status might change to Limited or Paused. In the unified view, use the split-view Overview tab (Detecting), the Detecting With Toggle column, or Live Status in the bulk Actions menu. In legacy views, use the Rules Editor header (Detecting), the legacy rule settings menu (Live Rule), or Rule Options. For more information, see Apply a rule to live data. |
| Alerting | Turn on to flag detections as Google SecOps alerts and trigger configured notifications or SOAR playbooks. Turn off to record detections without generating alerts. In the unified view, change alerting in the split-view Overview tab, the Alerting With Toggle column, or the bulk Actions menu (On or Off). For more information, see Manage alerts and IOC matches. |
| Rule schedule or Run Frequency | View or configure how often a rule runs, which affects detection latency and how Google SecOps processes late-arriving data. Available in the rule settings menu, bulk Actions, Rule Options, and the split-view Rule schedule tab. Hidden in the rule settings menu for archived rules in split view and the Rules Editor. For more information, see Understand rule run scheduling and Configure customized schedules for rules. |
| Retrohunt | Run a custom rule against historical log data over a specified time range to find past occurrences of a threat. For more information, see Run a rule against historical data. |
| Edit Rule or View Rule | Open the rule text and settings. On the unified Rules tab, this option opens the inline split-view details panel (labeled View Rule for curated rules). In legacy views, this option opens the Rules Editor (labeled View Rule for read-only rules). |
| Duplicate Rule | Create a copy of a rule. Available in the unified split-view rule settings menu (for non-archived custom and curated rules) and in the Rules Editor. Hidden on the rules table and Detections page. |
| View Versions | View previous versions of a custom rule, compare changes, or restore an earlier version. Available in the unified split-view rule settings menu, the Rules Editor, and Rule Options on the Detections page (hidden on the rules table). For more information, see View rule versions. |
| View Rule Detections | Open the Detections page to inspect detections generated by this rule, trend graphs, and underlying event details. Hidden when you're already viewing the Detections page. |
| Go to Rule Pack or View and edit rule set | Open the parent curated rule pack or rule set. Shown for curated rules only (labeled Go to Rule Pack in the unified view and View and edit rule set in legacy views). |
| Assign Tags | Unified view only. Add or remove tags (such as MITRE ATT&CK tactics or custom labels) from the bulk Actions menu or split-view Overview tab. Click Manage Tags in the tag menu to create, edit, or delete custom tags. |
| Exclude | Legacy views only. Create a rule exclusion for the selected rule. For more information, see Suppress alerts using rule exclusions. |
| Archive or Unarchive | Hide a custom rule and its detections from the default dashboard view without deleting its data, or restore an archived rule. In the unified view, also available in the split-view Overview tab and bulk Actions menu. For more information, see Archive rules. |
Test your rule
To test a custom rule, select a Time range to test in the Test results panel and click Test. On the standalone Rules Editor tab, you must save a new rule before testing it (the unified split-view Logic tab lets you test unsaved drafts). Google SecOps runs the rule on events in the specified time range and displays results in the Test results panel. To stop a running test, click Cancel.
Test curated rules
You can also run tests to validate curated rules from the split-view Logic tab on the unified Rules tab (requires global data RBAC access). Rule testing isn't available for curated rules on the standalone Rules Editor tab.
Understand the payload limit for rule tests
Rule testing enforces limits to prevent browser memory exhaustion and crashes. The streaming limit caps uncompressed payload size at 50 MB rather than using a fixed row count alone. Because individual event and UDM payload sizes differ, the number of displayed detections varies. Rule testing also enforces a maximum limit of 10,000 detections.
When a test reaches either limit, Google SecOps stops streaming additional detections and displays the detections already received. One of the following warning banners appears, depending on which limit is reached:
| Limit | Banner title | Banner message |
|---|---|---|
| Data size (50 MB) | Maximum test data size limit reached |
The data size of detections returned exceeds the 50 MB maximum limit for rule testing. Results have been capped. |
| Detection count (10,000) | Maximum test detections limit reached |
The number of detections returned exceeds the 10,000 maximum limit for rule testing. Results have been capped. |
In the earlier legacy editor, reaching either limit displays Rule reached a limit. Data is incomplete. on the chart instead of these banners.
To test rules that exceed these limits, use any of the following approaches:
- To reduce the response payload size, narrow the test time range.
- To validate query logic across larger datasets, use the SIEM Search interface.
- To evaluate rules across large historical time ranges, run a retrohunt. Retrohunts run asynchronously on the backend and aren't constrained by browser streaming limits.
Understand test evaluation behavior
When you test a rule using Test, evaluation differs from live rules and retrohunts:
Test rule detections aren't saved, aren't viewable on the Rules tab (or the legacy Rules Dashboard tab), and don't generate alerts. This behavior lets you safely test and iterate on rule logic without affecting production.
If your rule uses the
suppression_windowoption, suppression isn't applied during testing. Suppression is a post-processing step that takes place only after a live rule writes detections.Successive runs of the same test rule might generate slightly different detections. Google SecOps runs a test rule in multiple parallel processes and streams detections as each process finishes. Minor timing differences can affect which duplicate detections are removed. Test results might also differ from live rule or retrohunt detections because evaluation windows can align differently.
For more information, see View and troubleshoot rules.
Need more help? Get answers from Community members and Google SecOps professionals.