PL EN
WB-BA2AE326TLP:CLEARWazuh 5

Wazuh 5: Sigma rules, detectors and findings instead of alerts

Sigma rules in Wazuh 5: required fields, modifiers, logsource.product, the draft, test and custom spaces, detectors, findings and case statuses.

Wazuh 5 no longer uses the XML rules known from 4.x to generate alerts: detection is described by rules in the Sigma format, detectors in the Wazuh indexer run them, and the result is a finding instead of an alert. This article describes the rule structure, the content lifecycle across spaces, and where findings go and how to manage them.

The description is based on the 5.0-rc documentation (documentation.wazuh.com/5.0-rc). This is a release candidate, so setting names and interface paths may still change before the stable version. Installation and architecture of Wazuh 5 are covered in a separate article, Wazuh 5: installation, and the list of all changes compared to 4.x in Wazuh 5 as a next-gen SIEM.

From a 4.x alert to a 5.x finding

In Wazuh 4.x, an XML rule in wazuh-analysisd produced an alert with a level from 0 to 16. In 5.0 the documentation describes a different flow: a raw log passes through a decoder, becomes a normalized event in the Wazuh Common Schema (WCS), and a detector checks it against Sigma rules. A match creates a finding. The documentation states directly that findings in Wazuh 5.0 play the same role that alerts played in 4.x.

StageWazuh 4.xWazuh 5.0-rc
Detection logicXML rule with if_sid, a level and groupsSigma rule in YAML
Who runs itwazuh-analysisd on the managerSecurity Analytics detector in the indexer
ResultAlert in wazuh-alerts-*Finding in wazuh-findings-v5-<category>
SeverityLevel 0 to 16level: informational, low, medium, high, critical
Handling by the analystOutside the productwazuh.case.* fields in the finding

Decoders still exist and still decide the quality of detection, because a rule sees only normalized fields. The rules for writing decoders in 4.x are covered in Wazuh custom decoders, and the detection engineering approach that carries over to the new version in Wazuh detection engineering.

Rule structure

A rule has three required blocks: detection, logsource and metadata, and the required top-level fields id, status and level. The mitre and compliance blocks are optional. The example from the documentation shows all blocks at once:

metadata:
  title: Python SQL Exceptions
  author: Thomas Patzke
  description: Detects SQL exceptions in Python applications according to PEP 249.
id: 9c1c1e3f-21ad-4db0-9bb4-5cf2e9c1b901
sigma_id: 19aefed0-ffd4-47dc-a7fc-f8b1425e84f9
status: stable
level: medium
enabled: true
tags:
  - attack.initial-access
  - attack.t1190
logsource:
  category: application
  product: python
detection:
  keywords:
    - DataError
    - IntegrityError
    - ProgrammingError
    - OperationalError
  condition: keywords
falsepositives:
  - Application bugs
mitre:
  tactic:
    id:
      - TA0001
    name:
      - Initial Access
  technique:
    id:
      - T1190
    name:
      - Exploit Public-Facing Application
  subtechnique:
    id: []
    name: []
compliance:
  pci_dss:
    - "6.5.1"
  gdpr:
    - Art. 32
FieldRequiredMeaning
idyesUUIDv4. When a rule is created, Wazuh assigns a new random UUID and replaces the value you entered
sigma_idnoThe original Sigma rule identifier, kept when importing from upstream
statusyesRule maturity. The rules page lists experimental, test and stable, the indexer page adds deprecated and unsupported, and case does not matter
levelyesinformational, low, medium, high or critical
enablednoA disabled rule stays in the catalog, but detectors do not run it
tags, falsepositivesnoATT&CK tags and known sources of false positives

Treat the id field as owned by the system: references to a rule in internal documentation are better based on metadata.title or on sigma_id, if the rule comes from the Sigma repository. This is a recommendation, not a product requirement.

Detection: selections, conditions and modifiers

The detection block contains named selections and a condition field that combines them with the operators and, or, not and with parentheses. A list of values under one field means OR, several fields in one selection mean AND. A keywords list without a field name also works as OR. The example with parentheses from the documentation:

detection:
  sel_high:
    event.severity|gte: 8
  sel_critical:
    log.level: CRITICAL
  filter:
    process.name: monitor
  condition: (sel_high or sel_critical) and not filter

Every field used in detection is checked against WCS. A rule that refers to a field missing from the schema is rejected at validation. So a typo in a field name ends in a validation error, not in a rule that never matches. WCS categories, streams and templates are covered in Wazuh Common Schema and wazuh-events-v5 indices.

Modifiers are appended after the field name with a pipe character and can be chained:

ModifierEffect
contains, startswith, endswithMatch a fragment, the beginning or the end of a value
base64, base64offsetCompare with a Base64-encoded value
wideConvert to UTF-16 before encoding, must come before base64 or base64offset
windashDash variants in Windows command line switches
reRegular expression, flags i, m, s
cidrIP address within the given network
existsThe field exists (true) or does not exist (false)
allAll values from the list must match, not for a single-element list
lt, lte, gt, gteNumeric comparisons

Examples of chains from the documentation: process.command_line|base64offset|contains: "/bin/bash" and process.command_line|wide|base64offset|contains: "ping".

logsource.product ties a rule to an integration

logsource has one required field: product. Its value must be identical to the integration title (the integration’s metadata.title) in which you create the rule. This decides which detector runs the rule. Content Manager rejects a rule with a non-matching product with a 400 Bad Request code. The category, service and definition fields are optional and, according to the documentation, do not affect matching.

Integration categories in WCS also determine the name of the events and findings index:

WCS categoryExample integrations
access-managementokta, keycloak, jumpcloud
applicationsapache-http, nginx, google-workspace
cloud-servicesaws, azure, gcp, github
network-activitycisco-asa, fortinet, pfsense, netflow
securitycrowdstrike, suricata, m365-defender, sentinel-one
system-activitysystem events, including the windows integration

Below is a synthetic rule for the apache-http integration. It looks for a segmentation fault message, skips events from the 192.0.2.0/24 test network, and inserts the agent identifier into the finding title:

id: 00000000-0000-4000-8000-000000000001
status: experimental
level: high
logsource:
  product: apache-http
detection:
  selection:
    message|contains:
      - exit signal Segmentation Fault
    wazuh.integration.name: apache-http
  filter:
    source.ip|cidr: 192.0.2.0/24
  condition: selection and not filter
metadata:
  title: "Apache segmentation fault in agent {{ wazuh.agent.id }}"
  description: Example rule for a lab integration.
tags:
  - attack.impact
  - attack.t1499.004

Placeholders in metadata

The {{ field.path }} syntax inserts a field value from the event into the finding. For an event with wazuh.agent.id = "001", the title from the example above is saved as “Apache segmentation fault in agent 001”. Interpolation rules:

  • It works only in title, tags, the mitre.* fields and all compliance.* arrays.
  • Nothing in detection is interpolated, neither selections nor condition.
  • Text, a number and a boolean are converted to text, an array is expanded.
  • A missing field, null or an object gives empty text. A value that comes out entirely empty is omitted.
  • The substitution happens before writing to wazuh-findings-v5-<category>. The rule document itself does not change.

MITRE and compliance

The mitre block has three levels: tactic, technique and subtechnique. Each contains parallel id and name arrays in the same order. When a rule has no subtechnique, both arrays stay empty, as in the Python SQL Exceptions example.

The compliance block accepts compliance framework keys with a list of identifiers:

KeyExample from the documentation
gdprArt. 32
pci_dss2.2.1
nist_800_53AC-3, AU-2
nist_800_1713.1.1
iso_27001A.8.16
nis2Art. 21, Art. 23
hipaa164.312(a)(1)
tscCC6.1
fedrampAC-2, SI-4
cmmcAC.1.001

The Article 21 measures and Article 23 reporting duties of NIS2 are covered in the post on Wazuh and NIS2.

Spaces: draft, test, custom, standard

Detection content (decoders, KVDBs, filters, integrations, rules) lives in four spaces:

SpaceWriteRole
draftyesThe only place to create and edit your own content
testread onlyValidation and testing in the Log test tool
customread onlyYour own content, active in production
standardread onlyOfficial Wazuh content synchronized from CTI

Content moves along the path draft, test, custom. At every promotion, Content Manager deploys the content to the analysis engine, validates the configuration, triggers a reload, and only then updates the target space. Before promotion it shows a preview of new, changed and deleted resources, checks syntax and references, and on a partial failure protects against leaving an inconsistent state.

In 4.x you had to build this discipline yourself around wazuh-logtest and rule reloading, as described in Wazuh logtest. In 5.0 the testing stage is part of the product.

The draft has limits, changeable dynamically in the Content Manager settings:

SettingDefault
max_rules200
max_decoders200
max_integrations100
max_kvdbs100
max_filters100 per space

Creating a resource over the limit ends with a 400 Bad Request code. The module API is available under /_plugins/_content_manager/. Content Manager sends a telemetry ping once a day with the cluster UUID and version, and you turn it off with the plugins.content_manager.telemetry.enabled setting set to false.

Detectors

A detector runs rules on indexed events on a given schedule. Detectors are not subject to promotion: they exist only in the custom or standard space. You create a new detector in Ruleset management, Detection, Detectors, with the Create Detector button: name, data source, indices, space, integration, rule selection and schedule.

Limits from the indexer documentation:

  • A detector uses Standard or Custom rules, never both at once.
  • By default it holds up to 50 rules, and the plugins.security_analytics.max_rules_per_detector limit changes this.
  • A request that breaks any of the restrictions on create or update gets 400 Bad Request.
  • A rule change takes effect from the next detector run. Existing findings are not modified.

A rule from standard cannot be edited or disabled, because the space synchronizes with CTI. To silence a single rule, you stop the standard detector and create your own. The example from the documentation for the rule “Event log cleared via command line” from the windows integration:

  1. In Detectors, with the Standard space, select the windows detector and use Stop detector in the Actions menu. Note the Data source and Integration.
  2. Create a windows-Custom detector on the wazuh-events-v5-system-activity index with the windows integration.
  3. In Selected rules, leave the rules from Standard selected and clear “Event log cleared via command line”.
  4. Save. Wazuh places the new detector in the custom space.

The original detector stays in standard and still receives CTI updates. Your own detector does not update automatically, so you must attach new standard rules for this integration to it yourself.

Findings: where they go and what they contain

A match first creates a raw finding with the fields id, detector_id, related_doc_ids, queries, index and timestamp. Then, asynchronously, an enriched finding is created: the full event, the rule metadata in wazuh.rule, and enrichments such as source.geo, source.as or wazuh.threat. Enriched findings go to the wazuh-findings-v5-{category}* indices.

The module settings have the plugins.security_analytics prefix in /etc/wazuh-indexer/opensearch.yml, and most can be changed dynamically through _cluster/settings. The plugins.security_analytics.enriched_findings_index_enabled: false setting turns off writing to wazuh-findings-v5-*. Raw findings are still created in .opensearch-sap-{category}-findings-*.

Case handling in a finding

A finding carries case fields: wazuh.case.title, wazuh.case.description, wazuh.case.status, as well as severity, priority, TLP, tags and comments. The typical flow according to the documentation: a rule creates a finding, the analyst changes the status to acknowledged, adds notes and tags, and sets completed when done. A bulk update covers up to 10 findings by default (plugins.security_analytics.max_case_management_bulk_size) and returns 200, 207 on partial success, or 400.

A query for findings in the acknowledged status, in the documentation version:

curl -k -u <WAZUH_INDEXER_USERNAME>:<WAZUH_INDEXER_PASSWORD> -X GET "https://<WAZUH_INDEXER_IP>:9200/wazuh-findings-v5-*/_search" \
  -H "Content-Type: application/json" \
  -d '{
  "query": {
    "term": {
      "wazuh.case.status": {
        "value": "acknowledged"
      }
    }
  }
}'

In 4.x, alert handling statuses usually lived in an external ticketing system. In 5.0 part of this process can be kept at the finding itself. How to choose weights and thresholds so the analyst’s queue does not drown in noise is covered in Wazuh rule levels and thresholds, and the rules also apply to the level values in Sigma.

What the documentation does not specify

The 5.0-rc documentation does not describe a tool for converting 4.x XML rules to Sigma, nor an equivalent of the frequency and timeframe attributes of XML rules in the Sigma rule syntax. It also does not say how long the enrichment of a finding can lag behind the raw finding. Before migrating production rules, these questions must be checked on the stable release.

Sources

↑↓ select Enter open Esc close