Modern security environments generate logs from a wide variety of sources, including operating systems, cloud platforms, firewalls, web servers, identity providers, and custom-built applications. While many standard log formats are already supported by Wazuh, organizations frequently encounter proprietary or highly customized logs that require more advanced parsing and detection logic. These logs often contain multiple event types, nested fields, or varying message structures that cannot be handled effectively with a single detection rule. This is where Wazuh parent child rules become invaluable.
Instead of writing dozens of standalone rules that repeat the same conditions, Wazuh allows you to create a hierarchical rule structure.
A parent rule identifies a broad category of events, while child rules inherit the parent’s matching conditions and focus on detecting specific scenarios.
This approach reduces redundancy, improves maintainability, and makes complex detection logic significantly easier to manage.
Parent-child rule relationships are especially useful when working with:
- Custom enterprise applications that generate proprietary log formats
- Nested or structured JSON logs
- Authentication events with multiple possible outcomes (success, failure, MFA, lockouts)
- Firewall and network appliance logs containing different event categories
- Cloud service logs with shared metadata but different actions
Rather than duplicating identical matching logic across many rules, you define common conditions once in a parent rule and extend them through specialized child rules.
The result is a cleaner, more scalable ruleset that is easier to troubleshoot and expand as your environment evolves.
In this guide, you’ll learn how Wazuh parent child rules work, how they interact with decoders and alerts, when to use them, and how to design hierarchical detection logic for complex log formats.
You’ll also see practical examples, common mistakes to avoid, and best practices for building scalable custom detection rules.
Related Guide: How to Create Custom Detection Rules in Wazuh (With Examples)
What Are Wazuh Parent Child Rules?
Parent-child rules are a hierarchical detection mechanism within the Wazuh rules engine that allows multiple rules to share common matching logic.
Instead of treating every rule as an isolated entity, Wazuh enables child rules to inherit the context established by a parent rule and perform additional evaluation before generating alerts.
This design becomes particularly valuable when multiple security events originate from the same log source but represent different activities that require unique responses.
Parent Rules
A parent rule performs the initial evaluation of an event.
It typically matches broad characteristics such as:
- A specific decoder
- A log source
- An application
- A category of events
- Common field values
The parent rule establishes a foundation for subsequent processing but often does not generate the final security alert itself.
Instead, it passes matching events to one or more child rules for further evaluation.
For example, a parent rule might identify all authentication logs produced by a custom application regardless of whether the login succeeded or failed.
Child Rules
Child rules inherit the conditions established by the parent rule using the <if_sid> directive.
They apply additional filtering based on more specific criteria, such as:
- Failed logins
- Successful logins
- Administrator access
- MFA failures
- Password resets
- Account lockouts
Each child rule can assign its own:
- Severity level
- Alert description
- Compliance mappings
- MITRE ATT&CK techniques
- Active response actions
This allows a single parent rule to support dozens of specialized detections without duplicating the same matching logic.
How Rule Inheritance Works
Rule inheritance follows a simple processing flow:
- A decoder parses the incoming log.
- The parent rule evaluates broad matching conditions.
- If the parent rule matches, Wazuh evaluates any child rules referencing that parent.
- Child rules apply additional conditions.
- The matching child rule generates the final alert.
This layered approach keeps detection logic modular while avoiding repeated configuration across multiple rules.
Decoders vs. Rules
One of the most common areas of confusion is the distinction between decoders and rules.
A decoder extracts structured information from raw log messages.
It identifies fields such as usernames, source IP addresses, event types, process names, timestamps, or JSON attributes.
A rule evaluates those extracted fields and determines whether the event represents something noteworthy enough to generate an alert.
Think of the workflow like this:
- Decoder: “What information exists in this log?”
- Rule: “Does this information represent a security event?”
Without properly extracting fields through decoders, rules have little meaningful data to evaluate.
Related Guide: Wazuh Decoder Guide
Relationship Between Parent Rules, Child Rules, and Alerts
Parent rules are primarily responsible for categorizing events.
Child rules determine exactly what happened.
For example:
- Parent rule detects “authentication event.”
- Child rule A detects “successful login.”
- Child rule B detects “failed login.”
- Child rule C detects “administrator login.”
- Child rule D detects “multiple failed attempts.”
Although all four child rules originate from the same parent, each generates a different alert with its own severity and response.
This separation greatly improves clarity because broad parsing logic remains centralized while individual detections remain focused.
Benefits of Hierarchical Rule Design
Hierarchical rule design offers several operational advantages for security teams.
Less duplicated configuration
Common matching conditions only need to be defined once.
Easier maintenance
Changes to shared logic are made in a single parent rule rather than across dozens of individual rules.
Greater scalability
New event types can be added simply by creating additional child rules.
More consistent detections
Shared logic reduces configuration drift and minimizes inconsistent rule behavior.
Improved troubleshooting
Since parsing and detection responsibilities are clearly separated, diagnosing rule issues becomes much simpler.
The official Wazuh documentation also recommends organizing custom rules into logical hierarchies whenever possible because doing so simplifies long-term maintenance and improves readability for large rulesets.
Why Use Parent Child Rules in Wazuh?
As Wazuh deployments grow, so do the number of log sources, detection rules, and alert conditions.
Writing separate standalone rules for every event quickly becomes difficult to manage, especially when many rules share identical matching criteria.
Parent-child rules solve this problem by separating shared logic from specialized detections.
Instead of copying the same conditions repeatedly, security teams define common behavior once and extend it through child rules that focus on individual event outcomes.
This design not only reduces administrative overhead but also produces cleaner, more scalable rulesets.
Reduce Duplicate Rule Logic
Many log sources generate multiple event types that share the same structure.
For example, authentication logs may include:
- Login success
- *Login failure
- Password changes
- MFA verification
- Account lockouts
All of these events typically use the same decoder and many of the same fields.
Rather than creating five nearly identical rules, a parent rule performs the shared matching while child rules evaluate only the fields unique to each event.
This significantly reduces duplicated XML and makes the ruleset easier to understand.
Simplify Rule Maintenance
One of the biggest advantages of hierarchical rules is centralized maintenance.
Suppose your application changes its log format and a decoder name or common field changes.
With standalone rules, every affected rule must be updated individually.
With parent-child rules, only the parent usually requires modification, while all child rules continue working without additional changes.
This reduces both maintenance time and the risk of introducing inconsistencies.
Improve Detection Accuracy
Not every event should trigger the same alert.
A successful login generally represents normal activity, while repeated failed logins may indicate a brute-force attack.
Child rules allow you to create highly specialized detections for each outcome without duplicating shared conditions.
For example, one parent rule can support child rules that detect:
- Failed authentication
- Privileged account access
- Impossible travel events
- Service account usage
- Excessive login attempts
- Disabled account logins
Each child rule can assign its own severity level and response based on the risk of the specific activity.
Organize Large Rule Sets
Large enterprises often maintain hundreds or even thousands of custom detection rules.
Without a hierarchical structure, these rules become difficult to navigate and maintain.
Parent-child relationships naturally group related detections together, making the ruleset easier to:
- Read
- Review
- Debug
- Extend
- Audit
This organization becomes especially valuable when multiple analysts collaborate on custom detection content over time.
Support Complex Log Structures
Many modern applications produce logs that contain multiple event categories within the same data source.
Examples include:
- Nested JSON events
- Cloud audit logs
- Identity provider logs
- Firewall events
- API gateway logs
- Container platform logs
A single decoder can extract the common fields from these logs, while parent-child rules classify and evaluate the different event types independently.
This layered design aligns with modern detection engineering practices.
Organizations such as MITRE emphasize building modular detection logic that separates data collection from analytical decision-making, making security content easier to maintain and improve over time.
Related Guides:
Understanding How Rule Inheritance Works
One of the biggest strengths of Wazuh parent child rules is the way the rules engine evaluates events through a hierarchy.
Rather than testing every rule independently, Wazuh processes events in stages, allowing parent rules to establish context before child rules perform more granular analysis.
Understanding this evaluation process makes it much easier to design efficient rulesets and troubleshoot why a particular alert was, or was not, generated.
Rule Evaluation Order
When a log enters Wazuh, it passes through several stages before an alert is created.
The evaluation process generally follows this order:
- The log is collected by the Wazuh agent or manager.
- A decoder parses the raw log.
- Extracted fields become available for rule evaluation.
- Parent rules are evaluated.
- Matching child rules are evaluated.
- The best matching child rule generates the alert.
This staged approach avoids unnecessary processing because child rules are only evaluated if their parent rule has already matched.
Parent Rule Matching Process
A parent rule normally performs broad event classification.
It may identify logs based on:
- Decoder name
- Program name
- Event category
- Log source
- JSON field existence
- Regular expression matches
For example, a parent rule might simply identify all authentication logs generated by a custom application without determining whether authentication succeeded or failed.
This broad categorization allows many specialized detections to reuse the same foundation.
Child Rule Evaluation
Once the parent rule matches, Wazuh evaluates every child rule referencing that parent through the <if_sid> directive.
Each child applies additional conditions such as:
- Event outcome
- Username
- Source IP
- Group membership
- Authentication method
- Event severity
- Specific JSON field values
Only child rules whose conditions evaluate to true continue processing.
This layered filtering greatly reduces duplicated XML while improving readability.
Multiple Child Rules Under One Parent
One parent rule can support dozens of child rules.
For example, a custom authentication application could use the following hierarchy:
| Parent Rule | Child Rule | Purpose |
|---|
| Authentication Event | Login Success | Successful authentication |
| Authentication Event | Login Failure | Failed credentials |
| Authentication Event | MFA Failure | Multi-factor authentication failed |
| Authentication Event | Password Reset | Password change detected |
| Authentication Event | Account Locked | User locked after repeated failures |
| Authentication Event | Admin Login | Privileged account login |
Every child inherits the parent’s common matching logic while focusing only on its unique conditions.
This keeps the ruleset modular and significantly easier to maintain.
Nested Parent-Child Relationships
Wazuh also supports deeper inheritance chains.
Instead of a single parent and child, you can build multiple levels of rule inheritance.
For example:
This allows increasingly specific detections while minimizing duplicated logic.
However, excessive nesting can make rules more difficult to understand, so most deployments benefit from keeping inheritance relatively shallow.
Alert Inheritance Behavior
Although child rules inherit the parent’s matching context, they do not automatically inherit every property.
A child rule typically defines its own:
- Rule ID
- Description
- Severity level
- Groups
- Compliance mappings
- MITRE ATT&CK techniques
- Active responses
The parent simply establishes the event context.
Most production deployments use parent rules primarily for classification while allowing child rules to generate meaningful alerts.
Rule IDs and Dependencies
Every Wazuh rule must have a unique numeric ID.
Child rules reference their parent through the <if_sid> element.
For example:
In this example:
- Rule 100100 classifies authentication events.
- Rule 100101 only executes if 100100 has already matched.
Maintaining a logical rule ID range makes large custom rulesets much easier to manage over time.
Related Guide: How to Create Custom Detection Rules in Wazuh (With Examples)
Parent Rules vs Child Rules
Although parent and child rules work together, they serve very different purposes within the Wazuh detection engine.
The following comparison highlights their respective roles.
| Feature | Parent Rules | Child Rules |
|---|
| Purpose | Identify broad categories of events | Detect specific event conditions |
| Matching Conditions | General conditions such as decoder, source, or event category | Additional filters like usernames, outcomes, field values, or regex matches |
| Alert Generation | Often used only for classification (commonly level="0") | Usually generate the final security alert |
| Reusability | Shared by multiple child rules | Built for specific detection scenarios |
| Maintenance | Update one parent to affect many child rules | Modify only individual detections when necessary |
| Performance | Prevents repeated evaluation of identical logic | Evaluated only after parent matches, reducing unnecessary processing |
| Typical Use Cases | Authentication events, firewall logs, cloud logs, application logs, JSON parsing | Failed logins, privilege escalation, blocked traffic, malware detections, policy violations |
In general:
- Parent rules answer “What type of event is this?”
- Child rules answer “What exactly happened?”
This separation makes large detection libraries far easier to maintain and expand.
Building Your First Parent Child Rule
Now that you understand how inheritance works, let’s build a simple parent-child rule hierarchy.
This example assumes a custom authentication application generates logs similar to:
A custom decoder has already extracted the fields.
Related Guide: Wazuh Decoder Guide
Creating the Parent Rule
The parent rule should identify the general category of logs without determining the specific outcome.
Its purpose is to establish the common conditions shared by every authentication event.
Example:
Notice that:
- The decoder identifies the log source.
- The rule uses level=”0″ because it acts as a classifier.
- No alert is generated yet.
- Every authentication event now shares this common parent.
Shared Log Conditions
Parent rules typically contain conditions that remain true across multiple event types.
Examples include:
- Decoder name
- Program name
- Log source
- Vendor
- JSON object type
- Device category
These shared conditions should only appear once in the parent rule rather than being repeated throughout the ruleset.
Base Matching Criteria
Good parent rules are intentionally broad.
Examples include:
- All VPN authentication events
- All firewall traffic
- All cloud audit logs
- All endpoint security events
- All web application requests
Specific detections belong in child rules rather than the parent.
This keeps the hierarchy flexible as new event types are added.
Creating Child Rules
After establishing the parent, create child rules for each specific event outcome.
Each child references the parent using <if_sid>.
Success Events
This rule only evaluates after the parent has identified the log as an authentication event.
Failure Events
Because failed logins typically indicate higher security relevance, this child uses a higher severity level.
Warning Events
Suppose the application records suspicious activity without an outright authentication failure.
Additional child rules can be added later without modifying the parent.
This is one of the biggest advantages of hierarchical rule design.
Validating the Configuration
Before relying on new rules in production, verify that they load correctly and behave as expected.
Rule Syntax Checks
Carefully review:
- XML formatting
- Closing tags
- Rule IDs
<if_sid> references- Field names
- Decoder names
A single syntax error can prevent the ruleset from loading.
Loading the Rules
Save the custom rules file in the appropriate Wazuh rules directory and ensure it is referenced by your configuration.
Then verify that Wazuh successfully loads the new rules during startup.
Restarting the Wazuh Manager
After updating custom rules, restart the Wazuh manager so the new configuration is applied.
Once restarted, monitor the manager logs for any parsing or loading errors before proceeding with testing.
Applying Configuration Changes
Finally, validate your hierarchy using wazuh-logtest.
Feed sample log entries into the utility and verify that:
- The decoder extracts the expected fields.
- The parent rule matches first.
- The appropriate child rule executes.
- The expected alert level and description are generated.
Testing every branch of your parent-child hierarchy helps catch configuration issues early and ensures future rule additions don’t introduce unexpected behavior.
Related Guides:
Mapping Complex Log Fields with Parent Child Rules
Many enterprise applications produce logs that contain dozens of fields describing different aspects of an event.
Rather than creating one massive rule that attempts to evaluate every possible field, Wazuh parent child rules let you classify the event once and then create specialized child rules for different event types.
This modular approach makes rule development simpler, improves readability, and allows your detection logic to scale as new log formats are introduced.
Multi-Step Authentication Logs
Authentication systems often generate multiple events throughout a single login session.
These may include login attempts, MFA verification, password validation, account lockouts, and session termination.
A parent rule can identify all authentication events, while child rules evaluate individual fields to detect specific security scenarios.
Common fields include:
| Field | Example | Child Rule Purpose |
|---|
| Username | jdoe | Detect privileged account usage |
| Source IP | 192.168.10.15 | Detect suspicious login locations |
| Authentication Result | success, failure, locked | Trigger different alert severities |
| Session ID | A94C2D8F | Correlate related authentication events |
Example detection hierarchy:
This design allows every authentication event to share the same parent while keeping each security detection focused and maintainable.
Application Audit Logs
Business applications frequently record detailed audit information describing user activity.
Examples include:
- User logins
- Data modifications
- Record creation
- Permission updates
- Administrative actions
Useful fields often include:
| Field | Example |
|---|
| User Action | Delete Record |
| Object ID | Customer-18345 |
| Permission Change | Administrator Granted |
A parent rule can classify all audit events, while child rules distinguish between routine activity and high-risk administrative changes.
For example:
- Child Rule 1 → Record created
- Child Rule 2 → Record deleted
- Child Rule 3 → Administrator permission granted
- Child Rule 4 → Sensitive configuration modified
This structure avoids repeating the same application-matching logic throughout the ruleset.
Firewall Events
Firewall devices generate numerous event types while sharing many common fields.
Typical fields include:
| Field | Example |
|---|
| Source | 10.1.10.25 |
| Destination | 172.16.5.100 |
| Protocol | TCP |
| Action | Allow / Deny |
Instead of writing separate standalone rules for every action, a parent rule can classify firewall traffic while child rules evaluate specific behaviors.
Examples include:
- Allowed traffic
- Blocked connections
- Denied administrator access
- Port scanning attempts
- Repeated connection failures
This hierarchy becomes especially valuable when monitoring multiple firewall vendors using similar detection logic.
Related Guide: How to Collect Firewall Logs in Wazuh
Cloud Service Logs
Cloud providers produce highly structured audit logs containing extensive metadata.
Frequently monitored fields include:
| Field | Example |
|---|
| Account | Production |
| Region | us-east-1 |
| API Action | DeleteBucket |
| Resource ID | arn:aws:s3:::company-backups |
A parent rule can identify cloud audit events regardless of provider, while child rules detect actions such as:
- Privileged API calls
- Resource deletion
- Identity policy changes
- Failed authentication
- New administrator creation
Because cloud environments evolve rapidly, hierarchical rules make it much easier to extend detections as new services are introduced.
Related Guide: How to Monitor AWS CloudTrail Logs Using Wazuh
Endpoint Security Logs
Endpoint protection platforms generate process execution events, malware detections, registry modifications, and file activity.
Useful fields include:
| Field | Example |
|---|
| Process | powershell.exe |
| Parent Process | winword.exe |
| SHA-256 Hash | 1A3B… |
| File Path | C:\Users\Public\script.ps1 |
A parent rule can classify process creation events while child rules detect behaviors such as:
- Office spawning PowerShell
- Unsigned executable launches
- Suspicious parent-child process relationships
- Known malware hashes
- Execution from temporary directories
This layered approach produces cleaner rules than embedding every condition into a single XML rule.
Research from the MITRE ATT&CK framework consistently emphasizes correlating process ancestry, command-line activity, and parent-child process relationships when detecting adversary techniques such as command execution, credential access, and lateral movement.
Example Configuration
The following example demonstrates a complete parent-child rule hierarchy for a custom authentication application.
The parent rule classifies authentication events, while multiple child rules detect successful logins, failed logins, and administrator access.
Each child assigns its own severity, groups, and MITRE ATT&CK mappings.
Parent Rule
The parent rule performs broad classification.
Its responsibilities include:
- Identifying the decoder
- Grouping authentication events
- Providing a shared entry point for every child rule
Notice that the rule uses level=”0″, meaning it classifies events without producing a security alert.
Multiple Child Rules
Each child references the parent using:
This instructs Wazuh to evaluate the child only after the parent has successfully matched.
Because every child inherits the same context, duplicate XML is eliminated.
Field Matching
Child rules evaluate additional fields extracted by the decoder.
Examples include:
or
Multiple field conditions can be combined to create increasingly specific detections.
Severity Assignment
Each child assigns an appropriate severity level based on risk.
For example:
| Event | Suggested Level |
|---|
| Successful Login | 3 |
| Password Warning | 5 |
| Failed Login | 8 |
| Administrator Login | 10 |
| Brute Force Attack | 12–15 |
Separating severity at the child level allows the same parent to support both informational and high-priority alerts.
MITRE ATT&CK Mapping
Wazuh supports associating alerts with MITRE ATT&CK techniques.
Examples include:
- T1110 — Brute Force
- T1078 — Valid Accounts
These mappings help security teams understand adversary behavior and improve reporting within the Wazuh Dashboard.
Groups
Groups categorize related alerts for searching, filtering, dashboards, and reporting.
Examples include:
- authentication
- brute_force
- privilege_access
- compliance
- custom_app
Consistent group naming makes large deployments easier to organize.
Descriptions
Each child rule should contain a clear, concise description explaining the detected activity.
Examples:
- User login successful
- Authentication failure detected
- Administrator account login detected
- Password reset performed
- Suspicious privilege escalation
Clear descriptions improve analyst triage and reduce investigation time.
Related Guide: How to Create Custom Detection Rules in Wazuh (With Examples)
Testing Parent Child Rules
After creating your rules, always verify that they behave exactly as expected before deploying them into production.
Testing ensures that the decoder extracts the correct fields, the parent rule matches the intended events, and the appropriate child rule generates alerts.
Using wazuh-logtest
The wazuh-logtest utility is the primary tool for validating custom decoders and rules.
It allows you to submit sample log entries and observe every stage of processing, including:
- Decoder selection
- Extracted fields
- Parent rule matching
- Child rule evaluation
- Final alert generation
This makes it the fastest way to identify configuration issues before they affect production monitoring.
Verifying Parent Rule Matches
Start by confirming that the parent rule successfully identifies the event category.
Typical checks include:
- Correct decoder selected
- Expected fields extracted
- Parent rule ID matched
- No XML parsing errors
If the parent rule fails, none of its child rules will execute.
Confirming Child Rule Execution
Once the parent matches, verify that the correct child rule is selected.
For example:
| Sample Event | Expected Child Rule |
|---|
| Successful login | Success rule |
| Failed login | Failure rule |
| Administrator login | Privileged login rule |
| Account lockout | Lockout rule |
Only the child whose conditions evaluate to true should generate the alert.
Reviewing Generated Alerts
Inspect the resulting alert and confirm that it includes the expected:
- Rule ID
- Description
- Severity level
- Groups
- MITRE ATT&CK mapping
- Extracted fields
If any of these values are incorrect, review both the decoder output and the child rule conditions.
Testing Multiple Log Samples
Never validate your rules using only one log entry.
Instead, build a representative test dataset that includes:
- Normal user logins
- Failed authentication attempts
- Administrator activity
- Invalid input
- Malformed logs
- Unexpected field values
Testing both positive and negative cases helps ensure your rules generate alerts only when intended.
Debugging Rule Behavior
If a child rule fails to trigger, work through the evaluation pipeline systematically:
- Confirm the log reaches the Wazuh manager.
- Verify the correct decoder is applied.
- Ensure all expected fields are extracted.
- Check that the parent rule matches.
- Verify the
<if_sid> references the correct parent rule ID. - Confirm field names and values exactly match the decoded output.
- Review the manager logs for XML or syntax errors.
Following this sequence isolates problems quickly and avoids chasing issues in the wrong stage of the detection pipeline.
Related Guides:
Common Mistakes and How to Avoid Them
Even experienced Wazuh administrators can encounter issues when building hierarchical rule sets.
Most problems stem from incorrect rule relationships, missing decoded fields, or overly broad matching criteria.
Understanding these common pitfalls will help you build more reliable and maintainable Wazuh parent child rules.
Incorrect Parent Rule IDs
One of the most common mistakes is referencing the wrong parent rule ID in a child rule.
For example:
If rule 100100 does not exist or the ID is incorrect, the child rule will never be evaluated.
How to avoid it:
- Verify every
<if_sid> references an existing parent rule. - Keep custom rule IDs organized within a dedicated range.
- Document parent-child relationships as your ruleset grows.
- Use consistent naming conventions alongside rule IDs.
Child Rules Never Trigger
Sometimes a parent rule matches successfully, but none of the child rules generate alerts.
Common causes include:
- Incorrect field names
- Typographical errors
- Field values that don’t match decoded output
- Decoder parsing failures
- Incorrect regular expressions
Always remember that child rules evaluate the decoded fields, not the original raw log.
How to avoid it:
- Test each rule with wazuh-logtest.
- Compare child rule conditions against the decoder output.
- Validate every extracted field before writing child rules.
Related Guide: Troubleshooting wazuh-logtest: Why Alerts Are Missing from JSON Output
Overlapping Rule Conditions
Two or more child rules may unintentionally match the same event.
For example:
- Rule A matches all failed logins.
- Rule B matches all administrator logins.
- An administrator login failure satisfies both rules.
Without careful planning, this can produce multiple alerts for a single event.
How to avoid it:
- Make child rule conditions as specific as possible.
- Design mutually exclusive rule logic where appropriate.
- Test edge cases that may satisfy multiple conditions.
Missing Field Extraction
Rules cannot evaluate fields that were never extracted by the decoder.
For example, attempting to match:
will always fail if the decoder never extracted the username field.
How to avoid it:
- Validate decoder output before writing rules.
- Ensure every required field is available.
- Update custom decoders whenever log formats change.
Related Guide: Wazuh Decoder Guide
Rule Evaluation Order Problems
Some administrators assume child rules execute independently.
In reality:
- Decoder runs first.
- Parent rule matches.
- Child rules execute afterward.
If the parent never matches, every dependent child rule is skipped.
How to avoid it:
- Verify the parent rule first.
- Build and test hierarchies incrementally.
- Confirm the evaluation flow using wazuh-logtest.
Duplicate Alerts
Poorly designed hierarchies can generate multiple alerts for the same security event.
For example:
- Generic failed login rule
- Generic authentication failure rule
- Brute-force rule
If all three match simultaneously, analysts receive unnecessary duplicate alerts.
Duplicate alerts contribute to alert fatigue and make investigations more difficult.
How to avoid it:
- Design a clear hierarchy.
- Keep parent rules informational whenever possible.
- Reserve alert generation for the most specific child rules.
- Review alerts after deployment to identify unnecessary duplication.
Excessively Broad Parent Rules
Parent rules should classify related events, not match nearly everything.
An overly broad parent may unintentionally trigger hundreds of child rules for unrelated logs, reducing performance and increasing false positives.
For example, matching every JSON log regardless of source is rarely a good design.
How to avoid it:
Good parent rules should identify:
- One application
- One device category
- One event family
- One log source
Keeping parent rules focused produces cleaner, faster, and more scalable rule hierarchies.
Best Practices for Wazuh Parent Child Rules
As your Wazuh deployment grows, thoughtful rule design becomes increasingly important.
Following established best practices results in cleaner XML, easier maintenance, fewer false positives, and a ruleset that can evolve alongside your infrastructure.
Keep Parent Rules Generic
Parent rules should identify broad event categories rather than individual security events.
Examples include:
- Authentication events
- Firewall traffic
- VPN activity
- Cloud audit logs
- Endpoint process events
Avoid embedding highly specific conditions into the parent.
Make Child Rules Highly Specific
Child rules should contain the detailed detection logic.
Examples include:
- Administrator login
- Failed authentication
- Account lockout
- Privilege escalation
- Suspicious PowerShell execution
The more focused the child rule, the easier it is to understand, troubleshoot, and extend.
Use Meaningful Descriptions
Rule descriptions should clearly explain the detected activity.
Good examples include:
- Administrator account login detected
- Multiple failed authentication attempts
- Suspicious PowerShell launched from Office
- Firewall blocked inbound SSH connection
Clear descriptions help analysts quickly understand the alert without opening the rule definition.
Reuse Parent Rules Whenever Possible
Before creating a new parent rule, determine whether an existing one can support additional child rules.
Reusing parents:
- Reduces duplicated logic
- Simplifies maintenance
- Improves consistency
- Makes future expansion easier
Group Related Detections Logically
Use meaningful rule groups to organize alerts.
Examples include:
- authentication
- endpoint
- firewall
- malware
- cloud
- privilege_access
- compliance
Consistent grouping improves filtering, dashboards, and reporting.
Test with Diverse Log Samples
Do not rely on a single sample log.
Test:
- Expected events
- Invalid events
- Malformed logs
- Missing fields
- Unexpected values
- Boundary conditions
Comprehensive testing significantly reduces production issues.
Assign Consistent Severity Levels
Severity should reflect the actual security risk.
For example:
| Event Type | Suggested Level |
|---|
| Informational activity | 1–3 |
| Warnings | 4–6 |
| Failed authentication | 7–9 |
| Privileged activity | 10–12 |
| Confirmed attack behavior | 13–15 |
Using consistent severity ranges makes alerts easier to prioritize across your environment.
Document Custom Rule Relationships
As rule libraries expand, documenting parent-child relationships becomes increasingly valuable.
Maintain documentation that includes:
- Rule IDs
- Parent dependencies
- Decoder requirements
- Expected fields
- Alert descriptions
- MITRE mappings
This makes onboarding new team members and troubleshooting significantly easier.
Version-Control Custom Rule Files
Store custom decoders and rules in a version control system such as Git.
Benefits include:
- Change history
- Rollback capability
- Code reviews
- Team collaboration
- Audit trails
Version control also makes it easier to test new detections before deploying them to production.
Review Rule Performance After Deployment
Rule development doesn’t end after deployment.
Monitor:
- Alert volume
- False positives
- False negatives
- Processing performance
- Rule execution frequency
Periodic reviews help identify opportunities to simplify rules, improve specificity, and retire obsolete detections.
The Center for Internet Security (CIS) recommends regularly reviewing and tuning detection content as part of continuous security monitoring to improve effectiveness and reduce alert fatigue.
Real-World Example
A multinational organization’s security operations center (SOC) is responsible for monitoring a custom identity management platform used by employees, contractors, and third-party vendors.
The platform generates proprietary authentication logs that are not supported by Wazuh’s built-in ruleset.
Each log contains shared metadata, including the application name, event category, timestamp, and session identifier, as well as event-specific fields such as event_type, result, username, source_ip, multi-factor authentication (MFA) status, password reset actions, and account lockout information.
Initially, the SOC created individual standalone rules for every authentication event.
Each rule repeated the same application matching conditions, resulting in hundreds of lines of duplicated XML.
As the platform evolved and new event types were introduced, maintaining the rules became increasingly time-consuming, and inconsistencies began appearing between similar detections.
Solution:
To simplify the ruleset, the analysts redesign it using Wazuh parent child rules.
First, they create a generic parent rule that matches every authentication event produced by the custom application after the decoder extracts the relevant fields.
The parent rule performs only broad event classification and does not generate alerts.
Next, they build multiple child rules that reference the parent using <if_sid>.
Each child evaluates specific decoded fields, including:
event_typeresultusernamesource_iprolemfa_status
This allows them to create specialized detections for scenarios such as:
- Successful user logins
- Failed password attempts
- Repeated authentication failures indicating possible brute-force activity
- Administrator account logins
- Account lockouts
- Password resets
- Failed multi-factor authentication challenges
Each child rule assigns an appropriate severity level, places the alert into logical groups, and maps relevant activity to MITRE ATT&CK techniques where applicable.
For example, repeated failed login attempts are mapped to T1110 (Brute Force), while successful administrator logins are associated with T1078 (Valid Accounts).
Before deployment, the SOC validates every rule using wazuh-logtest to confirm that:
- The custom decoder extracts the expected fields.
- The parent rule matches all authentication events.
- Each child rule triggers only for its intended scenario.
- Alert descriptions, severity levels, and MITRE mappings are applied correctly.
After testing, the rules are deployed to production.
Result:
Within weeks, the team observes several measurable improvements:
- Duplicate rule definitions are virtually eliminated.
- New authentication event types can be added by creating additional child rules instead of rewriting existing logic.
- Rule maintenance becomes significantly faster because shared matching conditions exist in only one location.
- Alert consistency improves across all authentication-related detections.
- Analysts identify suspicious authentication behavior, including repeated failed logins, privilege escalation attempts, and account lockouts, more quickly because alerts are clearer, more specific, and consistently categorized.
The result is a scalable detection framework that is easier to maintain, adapts to changes in the application’s logging format, and provides higher-quality alerts for the SOC without increasing administrative overhead.
Related Guides:
Frequently Asked Questions (FAQ)
Question: What are Wazuh parent child rules?
Wazuh parent child rules are a hierarchical rule design method that allows security teams to organize detection logic into multiple levels.
A parent rule identifies a broad category of events, while child rules evaluate more specific conditions based on the information inherited from the parent.
For example, a parent rule may identify all authentication events from an identity management platform, while child rules detect:
- Successful logins
- Failed authentication attempts
- Administrator access
- Account lockouts
- MFA failures
This approach prevents duplicate logic and makes complex detection rules easier to manage.
Question: How do parent rules differ from child rules?
Parent and child rules have different responsibilities within the Wazuh detection engine.
Parent rules provide the initial classification layer by identifying the general type of event. They typically contain shared conditions and often do not generate alerts themselves.
Child rules perform the detailed analysis by evaluating specific fields and generating the final security alert.
| Parent Rules | Child Rules |
|---|
| Identify broad event categories | Detect specific security conditions |
| Contain shared matching logic | Contain specialized detection logic |
| Usually do not create alerts | Usually generate alerts |
| Act as reusable foundations | Handle individual scenarios |
| Referenced by child rules | Reference parent rules through <if_sid> |
A well-designed ruleset uses parent rules for classification and child rules for actionable detection.
Question: Can one parent rule have multiple child rules?
Yes. A single parent rule can support multiple child rules.
This is one of the primary advantages of hierarchical rule design.
For example, a firewall parent rule could have child rules for:
- Blocked inbound traffic
- Allowed administrative connections
- Port scanning activity
- Suspicious outbound communication
Similarly, an authentication parent rule could support child rules for:
- Successful login
- Failed login
- Privileged login
- Password reset
- Account lockout
Multiple child rules allow security teams to expand detection coverage without rewriting common logic.
Question: Do child rules inherit all conditions from the parent?
Child rules inherit the matching context established by the parent rule, but they do not automatically inherit every rule attribute.
The child rule depends on the parent matching first through:
The child can then add additional conditions, such as:
- Field matching
- Regular expressions
- Event values
- Usernames
- IP addresses
- Process names
However, child rules usually define their own:
- Severity level
- Description
- Groups
- MITRE ATT&CK mappings
- Compliance references
The parent provides the foundation, while the child provides the final detection logic.
Question: Can parent child rules improve performance?
Yes, properly designed parent-child rules can improve rule processing efficiency.
Instead of evaluating every detailed condition against every incoming event, Wazuh can first determine whether an event belongs to a specific category.
For example:
- Parent rule checks whether a log is an authentication event.
- Only matching authentication logs are evaluated against authentication child rules.
- Unrelated events skip those child rules.
This reduces unnecessary processing and makes large rulesets easier to scale.
However, poorly designed parent rules can have the opposite effect. Extremely broad parent rules may cause many unnecessary child evaluations, so parents should remain focused on specific event categories.
Question: How do I test parent child rules?
The recommended way to test parent-child rules is by using wazuh-logtest.
The testing workflow should include:
- Submit a sample log.
- Verify the correct decoder processes the event.
- Confirm extracted fields are available.
- Verify the parent rule matches.
- Confirm the expected child rule executes.
- Review the generated alert details.
Testing should include multiple scenarios, including:
- Expected successful events
- Failed events
- Edge cases
- Missing fields
- Unexpected values
This ensures the hierarchy behaves correctly before deployment.
Question: Can parent child rules work with custom decoders?
Yes. Parent-child rules work especially well with custom decoders.
Custom decoders extract structured information from unsupported or proprietary log formats, while parent-child rules use those extracted fields to create detection logic.
A typical workflow looks like this:
- Custom decoder parses the raw log.
- Decoder extracts fields such as username, IP address, event type, or action.
- Parent rule identifies the general event category.
- Child rules evaluate specific security conditions.
- Wazuh generates the appropriate alert.
This combination is commonly used for:
- Custom enterprise applications
- Internal authentication platforms
- Proprietary security tools
- Custom API logs
- Specialized infrastructure devices
Question: What happens if a parent rule does not match?
If the parent rule does not match, none of its child rules will be evaluated.
The child rule dependency chain is broken because the <if_sid> condition requires the parent rule to successfully match first.
For example:
If rule 100100 never matches:
- Rule
100200 is skipped. - No alert is generated.
- The event continues through the remaining Wazuh ruleset.
When child rules fail unexpectedly, always troubleshoot the parent rule first.
Conclusion
Complex log environments often require more than simple standalone detection rules.
Modern organizations collect events from custom applications, cloud platforms, authentication systems, firewalls, and endpoint technologies, each producing different log structures and security signals.
Wazuh parent child rules provide a scalable way to manage this complexity by separating broad event classification from detailed detection logic.
Parent rules establish shared conditions, while child rules focus on specific behaviors such as failed authentication attempts, privilege changes, suspicious processes, or malicious network activity.
This hierarchical approach delivers several benefits:
- Reduces duplicated rule logic
- Simplifies long-term maintenance
- Improves rule organization
- Supports complex log formats
- Makes detection logic easier to expand
- Produces more consistent alerts
When combined with custom decoders, parent-child rules create a powerful framework for detecting security events from virtually any log source.
Instead of creating isolated rules for every possible scenario, security teams can build reusable detection structures that grow alongside their environments.
Before deploying new rules into production, always validate them using wazuh-logtest.
Testing ensures that decoders extract the expected fields, parent rules match correctly, and child rules generate accurate alerts with appropriate severity levels.
A well-designed parent-child rule hierarchy reduces administrative overhead while improving detection quality.
\By organizing security logic into reusable layers, Wazuh administrators can build more reliable monitoring capabilities and maintain effective threat detection across increasingly complex logging environments.
Related Guides:
Be First to Comment