Duty analyst on shift

UK Cyber Defence
Guide

Wazuh rules: how they work, why they fail quietly, and 4,600 of ours to use

A Wazuh rule decides whether a line of log becomes an alert. This guide explains how rules are built and chosen, the six faults that stop one firing without any error, and how to use the 4,676 rules our own SOC runs, which we have published on GitHub.

A Wazuh rule is a few lines of XML that decide whether a line of log is ignored, recorded or raised as an alert. Wazuh ships with a large stock ruleset, and most deployments add rules of their own. We have published ours: the Wazuh rules, decoders and lists that the manager in our own security operations centre runs are public on GitHub and free to use. This guide explains how Wazuh rules work, the faults that stop a rule firing without raising any error, and what is in our public rules feed and how to deploy it.

What is a Wazuh rule?

A rule is a test applied to an event once a decoder has broken it into named fields. If the test passes, the rule's level and description become the alert that an analyst sees. If it fails, the event carries on to the next rule, and an event that matches nothing leaves no alert at all.

Diagram of how a Wazuh rule works in four steps: collect the log line, decode its fields, match rules, raise the alert
How a Wazuh rule works. A rule can only test what the decoder extracted and what its parent passed on.

Rules are arranged as families. A base rule claims a kind of event, usually by naming the decoder that parsed it, and child rules then test for the detail: a blocked connection, a failed login, a known bad address. Much of the work in writing Wazuh rules is putting each rule under the right parent and giving it the right level.

The anatomy of a Wazuh rule

Here are two rules from our public ruleset, for Forcepoint appliances. The first is a base rule and the second is one of its children.

<group name="forcepoint,">

  <rule id="107250" level="0">
    <decoded_as>forcepoint</decoded_as>
    <description>Forcepoint log detected</description>
  </rule>

  <rule id="107251" level="13">
    <if_sid>107250</if_sid>
    <match>Action=BLOCK</match>
    <description>Forcepoint Traffic: Blocked connection attempt</description>
    <group>firewall,blocked,</group>
  </rule>

</group>

Rule 107250 matches anything the forcepoint decoder has parsed and, at level 0, raises nothing by itself. Rule 107251 runs only on events that 107250 has already claimed, looks for the text Action=BLOCK, and raises an alert at level 13. Every other option in the rule syntax is a variation on those two ideas: say which events the rule applies to, then say what to look for in them.

Part of the ruleWhat it does
idThe rule's number, from 1 to 999999. It must be unique on the manager
levelThe severity, from 0 to 16
decoded_asLimits the rule to events parsed by a named decoder
if_sid, if_groupLimits the rule to events that a given rule, or any rule in a given group, has already matched
match, regex, fieldThe test itself, against the whole line or against one decoded field. A type attribute chooses the pattern syntax, including PCRE2
listLooks a field up in a CDB list, such as a list of known attacker addresses. The list must also be declared in ossec.conf
frequency, timeframeTurns a rule into a correlation: fire only after a number of matches within a number of seconds
descriptionThe alert text. Decoded fields can be inserted with $(field_name)
groupLabels used for filtering and by other rules. Every rule must belong to at least one group
mitreThe MITRE ATT&CK technique IDs the rule relates to

Wazuh's rules syntax reference describes every option.

Wazuh rule levels, from 0 to 16

Every rule carries a level, and the level decides what happens next. Wazuh's documentation gives each of the seventeen levels a name, from "Ignored" at 0 to "Maximum severity" at 16. Three points on that scale matter more than the rest. Level 0 rules are scanned before all the others and raise no alert, which makes them the tool for base rules and for switching off false positives. The default alert threshold is level 3, so a level 1 rule is evaluated but leaves no alert unless that threshold is lowered. Level 16 is the highest the scale allows.

The chart shows where the 4,676 rules in our public ruleset sit.

Bar chart of the 4,676 rules in UK Cyber Defence's public Wazuh ruleset by level, 0 to 16; 1,523 are level 12 or above
Rules in our public ruleset by level, counted on 5 December 2026. About a third of them, 1,523, sit at level 12 or above.

Choosing a level is a decision about what deserves a person's attention. The rules built on our Hive threat intelligence show the reasoning. Traffic from a known attacker address that a firewall has already dropped stays at level 4 or 5, so it is on record without filling the analysts' queue. The same traffic allowed through is level 10, a successful login from one of those addresses is level 13, and a file on a monitored host whose hash matches known malware is level 14.

Where Wazuh rules live, and which IDs to use

On a Wazuh 4.x manager the stock rules are in /var/ossec/ruleset/rules. Do not edit them there, because an upgrade overwrites that directory. Your own rules belong in /var/ossec/etc/rules: Wazuh's documentation on custom rules suggests local_rules.xml for small adjustments and new files in the same directory for anything larger.

The same documentation suggests IDs between 100000 and 120000 for custom rules, to avoid clashing with the stock ones. Our own ruleset outgrew that range long ago, and its IDs now run up to 999956, so each file has an ID range of its own and the repository's README keeps the inventory. If you combine rules from several sources, an inventory like that and a duplicate check are what stop two rules sharing an ID.

To change a stock rule, copy it into a file under /var/ossec/etc/rules and add overwrite="yes". Two details of an overwrite catch people out. The parent conditions (if_sid, if_group and their relatives) cannot be changed by an overwrite and keep their original values. Everything else is replaced, as one of the faults below shows.

How Wazuh chooses which rule fires

When several rules could match one event, the order is not obvious, and it is not simply the order of the files. These points come from testing our own ruleset on a Wazuh 4.14 manager, and they are recorded in the repository:

  • Rule files are read in name order, and a rule can only name a parent that has already loaded.
  • When an event matches a rule, Wazuh tries that rule's children: the level 0 children first, then the others from the highest level down. Load order only decides between children of the same level.
  • A child rule that matches replaces its parent's alert. A new rule with a lower level can therefore lower the severity of an alert you already rely on.
  • A frequency rule counts only the events whose final alert came from the rule or group it watches. A new child that takes those events away can stop a brute-force correlation from ever firing.

The last two points shaped how our Hive rules are written. Each one names its parents explicitly by ID, and a parent is used only if its level is at or below the Hive rule's own. A match against a known attacker address can raise the severity of an alert or add context to it, but it never lowers an alert or hides an event from a correlation.

Six faults that stop a Wazuh rule firing, with no error

A rule that fails to load produces an error. A rule that loads and then never fires produces nothing, and can sit in a ruleset unnoticed. When we cleaned and tested our own ruleset in November and December 2026 we found six kinds of silent fault, and we have published the full record, with every rule ID, in the repository.

Six faults that stop a Wazuh rule firing without an error: lists, decoders, parents, field names, paths and overwrites
Six reasons a Wazuh rule loads without complaint and never fires.

The list is not declared. A rule that looks something up in a CDB list needs that list declared in ossec.conf on every node that analyses events. A cluster does not copy ossec.conf between nodes, and a rule whose list is not declared is dropped with only a warning in the log.

Two decoders share a name. Two of our decoder files each defined a parent decoder called CEF. The first to load won, its children extracted no fields, and a set of Maltrail rules that depended on those fields had never matched. A level 0 rule then matched every CEF event, so CEF logs from every other vendor stopped there as well.

The parent means something else. Three rules for DLL and driver sideloading were children of a rule that our ruleset had redefined to mean a DNS query event. They were waiting for an image or driver load that their parent would never pass to them.

The field name starts with data. In alerts.json, decoded fields appear under a data. prefix. Inside the analysis engine they have no such prefix, so a rule that tests data.win.eventdata.hashes tests a field that does not exist.

A Windows path has one backslash. The Windows event channel decoder stores each backslash in a path twice. A pattern written with one backslash between two folder names asks for something that is never there. We found thirty such patterns.

An overwrite replaced too much. Six stock detections had been overwritten with level 0 copies meant to exclude a handful of known-good files. An overwrite keeps the stock parent and replaces every other condition, and the new conditions used the data. prefix, so they never matched. The result was that six stock Wazuh detections, among them the ones for PowerShell Invoke-Command and for an auto-elevating fodhelper, had stopped firing for every process.

Two smaller traps belong on the same list. In Wazuh's default regex syntax an unescaped full stop is a literal dot, not "any character". And a rule that cites a MITRE ATT&CK technique ID the manager's database does not hold still fires, but logs a warning every time it does.

The lesson we took is that a rule needs two tests. wazuh-analysisd -t proves that the ruleset loads. Only a real event, fed through /var/ossec/bin/wazuh-logtest, proves that a rule fires and shows which decoder and which rule the event reached. Saving the rule file is enough for wazuh-logtest to see a change; the manager has to be restarted before the change produces alerts.

Our public Wazuh rules feed

The repository at github.com/UK-Cyber-Defence/wazuh holds the ruleset our manager runs, synchronised from the live cluster and then cleaned of duplicates. On 5 December 2026 it contained 4,676 rules in 188 files, 703 decoders in 54 files and 39 lists. Rules written for an individual client are kept in a separate private repository, and customer and host names in the public comments are replaced with placeholders.

PartWhat it adds
Our own detectionsAmong them Forcepoint, Google Workspace, Microsoft Purview and Proofpoint, 200 data loss prevention rules, and 104 rules for our Zeek network sensor
Hive indicators33 rules and six lists of attacker infrastructure recorded by our Hive sensors, regenerated each month
Wazuh engineering blog465 rules from 63 articles published between December 2024 and November 2026
SOCFortressThe ruleset much of ours began as, brought up to date on 1 December 2026 with 792 further rules, including detections for attacks on AI agents
Community repositories233 rules from 13 permissively licensed repositories, covering Ubiquiti UniFi, MikroTik, WatchGuard, Proxmox, 1Password, Atlassian Cloud and others, and two Linux vulnerabilities: CVE-2026-43284 and CVE-2026-31431

Our own rules, decoders, lists and scripts are under the MIT licence. Imported content keeps its original licence, and each imported file names its source in its header. Our page on open source Wazuh support describes the contents in more detail, including what the rules need from your log sources. The Zeek rules are the ones our Raspberry Pi network sensor reports through, and our guide to building that sensor shows them at work.

How to deploy the rules feed

The repository includes a deployment script, because a ruleset this size should not be copied onto a production manager by hand.

git clone https://github.com/UK-Cyber-Defence/wazuh.git

# on the master and on each worker
sudo ./wazuh/tools/declare-lists.sh --no-restart lists seed-lists

# on the master only: show what would change
sudo ./wazuh/deploy.sh --dry-run

# on the master only: deploy, test, then restart the manager
sudo ./wazuh/deploy.sh

The script backs up the existing rules, decoders and lists, installs only the files that have changed, and never overwrites the allowlists that each environment maintains. It then runs wazuh-analysisd -t and restarts the manager. If the test fails, if a rule that was loading before is dropped, or if the manager does not come back, it restores the backup.

Three cautions before you run it. Try it on a test manager first, because this many rules will change what your manager alerts on. Check your own rule IDs against the inventory in the README. And read retired.txt, which lists superseded files that the script removes from the manager; some carry names from the SOCFortress ruleset, which matters if you already run those rules.

Wazuh rules and Wazuh 5.0

Everything above describes Wazuh 4.x, whose current release when this was written was 4.14.11, published on 25 November 2026. Wazuh 5.0 was still at release-candidate stage when we last checked. It brings a new detection engine and a new rule syntax, so rules written for 4.x, ours included, will need rewriting for it. Our Wazuh 5.0 readiness review explains what the move involves for a deployment with custom rules.

If you want a hand

The rules are free and need no account with us. Corrections are welcome as pull requests on GitHub. If you would rather have an engineer deploy the ruleset and tune it to your log sources, that is part of our Wazuh support plans and our Wazuh consulting. We are not a Wazuh partner; we are engineers who have run Wazuh, and OSSEC before it, in our own SOC since 2012. Our guides to installing Wazuh and to Wazuh troubleshooting cover the rest of the platform.

Questions about Wazuh rules

What are Wazuh rules?

Wazuh rules are XML definitions on the Wazuh manager that test each decoded event and decide whether it is ignored, recorded or raised as an alert, and at what level from 0 to 16.

Where are Wazuh rules stored?

On a Wazuh 4.x manager the stock rules are in /var/ossec/ruleset/rules and custom rules belong in /var/ossec/etc/rules. Changes made in the stock directory are overwritten by an upgrade.

Which ID should a custom Wazuh rule use?

Wazuh's documentation suggests IDs between 100000 and 120000 for custom rules. Whatever range you use, every ID must be unique on the manager, so keep an inventory if your rules come from more than one source.

How do I test a Wazuh rule?

Run wazuh-analysisd -t to check that the ruleset loads, then paste a real log line into /var/ossec/bin/wazuh-logtest to see which decoder and rule it reaches. Restart the manager before expecting alerts from a changed rule.

Why is my Wazuh rule not firing?

The usual causes raise no error: a CDB list that is not declared in ossec.conf, a decoder that does not extract the field the rule tests, the wrong parent rule, a field name written with the data. prefix, or a Windows path pattern with single backslashes.

Are there free Wazuh rules on GitHub?

Yes. Our production ruleset, more than 4,600 rules with their decoders and lists, is public at github.com/UK-Cyber-Defence/wazuh, and our own content in it is under the MIT licence.

Do Wazuh 4 rules work on Wazuh 5.0?

Not as they are. Wazuh 5.0 has a new detection engine and rule syntax, so custom rules and decoders written for 4.x need rewriting.

Sources

  • Wazuh documentation, Rules classification: the seventeen levels and the default alert threshold.
  • Wazuh documentation, Custom rules: where custom rules belong, the suggested ID range, overwriting a stock rule and testing with wazuh-logtest.
  • Wazuh documentation, Rules syntax: the options and their ranges.
  • Wazuh documentation, 4.14.11 release notes, 25 November 2026.
  • UK Cyber Defence, Wazuh rules repository: the README, and the records FAULT_FIXES.md, RULE_ID_COLLISIONS.md and SOCFORTRESS_SYNC.md, read on 5 December 2026.

Checked against these sources on 5 December 2026.

Share

Written by

Peter Bassill

Founder and Head of Threat Disruption

Founder of UK Cyber Defence. Fellow of the BCS and Chartered IT Professional; former CISO for FTSE 250 organisations and for Microsoft Europe; founded Hedgehog Security in 2009.

FBCSCITPCISSPCISAGitHubWebsiteLinkedIn

Next step

Want this looked at in your own estate?

Thirty minutes with an analyst, not a salesperson. We will tell you whether it matters to you and what to do first.

Related insights

Guide

Zeek on a Raspberry Pi: how to build a network sensor for Wazuh

How to build our open-source Zeek Pi node: the hardware, the operating system, installing Zeek and the Wazuh agent, joining it to a Wazuh cluster, and what it reports when the network it watches is an industrial one.

Peter Bassill16 min read
Insights

Seeing what your SOC sees: the new SIEM section in Pulse

Managed security has a quiet flaw: when it works, there is nothing to look at. The latest release of Pulse, our client portal, changes that. You can now watch the activity our Security Operations Centre records across your estate as it happens, see every monitored machine, and open the same page for each one that our analysts use. Here is what has changed, why we built it this way, and how to get the most from it.

Peter Bassill19 min read
Insights

One click, one new administrator: the Elementor CSRF flaw explained

A flaw in Elementor 4.3.0 and 4.3.1 lets anyone who can get a WordPress administrator to click a link create themselves an administrator account. No JavaScript, no form, no exploit kit: a plain link. Around two million sites were exposed. Here is how it works, why it is worse than it sounds, what to do this morning, and the Wazuh rules our SOC is using to see it.

Peter Bassill10 min read