Whether you’re creating custom detection rules, troubleshooting log parsing issues, or validating decoder changes, Wazuh Logtest is one of the most valuable tools available to Wazuh administrators.
Instead of waiting for live events to flow through your environment, Logtest allows you to simulate the entire detection pipeline and immediately see how Wazuh processes a log entry.
This dramatically reduces development time while helping you identify problems before they reach production.
You can verify that a decoder extracts the correct fields, confirm that rules trigger as expected, and determine why an event fails to generate an alert. This can be done all without impacting your production environment.
For organizations that rely on Wazuh for threat detection, intrusion monitoring, compliance, and security operations, testing detection logic before deployment minimizes false positives, prevents missed detections, and improves overall detection quality.
Throughout this guide, you’ll learn exactly how Wazuh Logtest works, how to use it effectively, interpret its output, troubleshoot common problems, and build reliable custom detection rules with confidence.
What Is Wazuh Logtest?
Definition of Wazuh Logtest
Wazuh Logtest (wazuh-logtest) is a command-line utility included with the Wazuh Manager that simulates the Wazuh log analysis engine.
It accepts a log entry as input and processes it through the same decoding and rule evaluation pipeline used during normal event processing.
Rather than waiting for a real endpoint or log source to generate an event, Logtest allows administrators to manually submit logs and instantly observe:
- How the log is pre-decoded
- Which decoder matches the log
- Which fields are extracted
- Which detection rules are evaluated
- Which alert would ultimately be generated
Because it mirrors the production analysis engine, Logtest provides an accurate way to validate new decoders, custom rules, and detection logic before deploying changes.
How Logtest Fits into the Wazuh Detection Pipeline
Every log processed by Wazuh follows a structured analysis pipeline before an alert is generated.
The workflow typically looks like this:
- A log is collected by a Wazuh agent or another supported log source.
- The log reaches the Wazuh Manager.
- Pre-decoding extracts basic metadata, such as timestamps, hostnames, and program names.
- The decoder analyzes the log format and extracts structured fields.
- Detection rules evaluate those extracted fields.
- If rule conditions are satisfied, Wazuh generates an alert.
Wazuh Logtest reproduces steps 3 through 6 without requiring live data.
This makes it possible to test detection logic repeatedly until the desired behavior is achieved.
If you’re developing custom parsers, you may also find Wazuh Decoder Guide helpful for understanding how decoders extract structured data from raw logs.
Similarly, if you’re creating custom detection logic, refer to How to Create Custom Detection Rules in Wazuh (With Examples).
Why Security Analysts Use Logtest
Security teams frequently modify detection rules to support:
- Custom applications
- Proprietary log formats
- Cloud services
- Internal security controls
- New threat detection techniques
Without testing, even a small syntax mistake can prevent alerts from firing correctly or create excessive false positives.
Logtest enables analysts to verify:
- Decoder accuracy
- Field extraction
- Parent-child rule relationships
- Rule inheritance
- Severity levels
- Alert descriptions
- MITRE ATT&CK mappings
- Rule chaining behavior
Instead of waiting for production events, analysts receive immediate feedback, allowing them to iterate rapidly during rule development.
Many Wazuh contributors recommend validating every custom decoder and rule using Logtest before production deployment because it closely matches the actual analysis engine and significantly reduces troubleshooting time.
Benefits of Validating Logs Before Deployment
Testing before deployment offers several operational and security advantages.
Faster development
Developers can immediately identify decoder or rule issues without repeatedly generating live events.
Reduced false positives
Rules can be tuned against representative log samples before affecting production alerts.
Improved detection accuracy
You can verify that all expected fields are extracted correctly and that detection rules fire only under the intended conditions.
Lower operational risk
Production rule changes become much safer because they’ve already been validated in a controlled environment.
Easier troubleshooting
Instead of searching through manager logs, Logtest pinpoints exactly where processing succeeds, or fails.
Independent security guidance consistently recommends testing detection content before production deployment as part of detection engineering and continuous validation practices.
Organizations such as the SANS Institute emphasize validating detection logic to reduce operational errors and improve SOC effectiveness.
How Wazuh Logtest Works
Wazuh Logtest follows the same multi-stage analysis pipeline used by the Wazuh Manager when processing incoming events.
Each phase builds upon the previous one until Wazuh determines whether an alert should be generated.
Understanding each stage makes troubleshooting much easier because you can quickly identify where processing stops.
Overview of the Log Analysis Process
Every submitted log passes through four primary stages:
- Raw log input
- Pre-decoding
- Decoder matching
- Rule evaluation
Each stage produces output that helps explain how Wazuh interpreted the event.
Rather than simply indicating whether a rule matched, Logtest exposes every intermediate processing step, making it one of the most valuable troubleshooting tools in the Wazuh ecosystem.
Phase 1: Log Pre-Decoding
The first phase performs lightweight parsing of the raw log.
During pre-decoding, Wazuh attempts to identify information such as:
- Timestamp
- Hostname
- Program name
- Syslog header
- Message body
No security rules are evaluated during this phase.
Instead, Wazuh prepares the event for decoder matching by separating common log components from the message payload.
If a log lacks a recognizable syslog header, pre-decoding may leave several metadata fields empty, which is completely normal for many custom application logs.
Phase 2: Decoder Matching
Once pre-decoding finishes, Wazuh compares the remaining log content against its decoder library.
Each decoder attempts to match:
- Log format
- Keywords
- Regular expressions
- JSON structures
- XML fields
- Custom patterns
If a decoder matches successfully, it extracts structured fields such as:
- Source IP
- Username
- Process name
- Event ID
- Destination port
- File path
- Status codes
Those extracted fields become available to subsequent detection rules.
Organizations that work with complex log formats often build layered decoder hierarchies to improve parsing efficiency.
For advanced implementations, see How to Map Complex Log Fields Using Wazuh Parent Child Rules.
Phase 3: Rule Evaluation
After decoding, Wazuh begins evaluating detection rules.
Rules examine:
- Decoder names
- Extracted fields
- Field values
- Parent-child relationships
- Rule dependencies
- Frequency conditions
- Correlation logic
- Severity levels
Multiple rules may match the same event before Wazuh determines the highest-priority alert.
This layered evaluation model allows administrators to create highly flexible detection logic while avoiding unnecessary rule duplication.
Understanding the Output at Each Phase
One of Logtest’s greatest strengths is its transparency.
Instead of simply reporting whether a rule matched, it displays the intermediate results generated during each processing stage.
Typical output includes:
| Phase | What you’ll see |
|---|---|
| Pre-decoding | Timestamp, hostname, program name, message body |
| Decoder | Decoder name, extracted fields, parsed values |
| Rule evaluation | Matching rule IDs, alert level, description, groups, compliance mappings |
When troubleshooting, the first place to look is the last successful phase:
- If pre-decoding succeeds but no decoder matches, the decoder likely needs adjustment.
- If decoding succeeds but no rules trigger, the rule conditions may be too restrictive.
- If multiple unexpected rules fire, rule precedence or inheritance may need refinement.
Learning to interpret these stages can dramatically reduce the time required to diagnose parsing or detection issues.
Prerequisites
Before using Wazuh Logtest, ensure your environment is properly configured.
While the utility is simple to use, successful testing depends on having the necessary components already in place.
Installed and Running Wazuh Manager
Because Logtest runs directly on the Wazuh Manager, the manager service must be installed and operational before testing logs.
You can verify that the manager is running before executing Logtest to avoid misleading errors.
If you’re deploying a new environment, review The Complete Wazuh Cluster Architecture Guide or How to Set Up a Multi-Node Wazuh Cluster for deployment guidance.
Administrative Access
Running Logtest typically requires administrative or root privileges on the Wazuh Manager server.
Administrative access is also necessary when:
- Editing decoders
- Creating custom rules
- Restarting Wazuh services
- Validating configuration changes
- Reviewing manager logs
Using an account with sufficient privileges helps avoid permission-related issues during testing.
Existing Decoders and Rules
Logtest evaluates logs using the decoders and rules currently loaded by the Wazuh Manager.
Before testing, verify that:
- Custom decoders are installed
- XML syntax is valid
- Rule files are loaded successfully
- Configuration changes have been applied
If you’re troubleshooting decoder issues, the following resources can help:
- Wazuh Decoder Guide
- How to Create Custom Detection Rules in Wazuh (With Examples)
- How to Test Wazuh Rules
Sample Logs Available for Testing
Meaningful testing requires representative log samples.
Ideally, collect logs directly from:
- Production systems (after sanitizing sensitive data)
- Development environments
- Test servers
- Security appliances
- Cloud services
- Custom applications
Testing with realistic log samples produces far more reliable results than using artificially simplified examples because it exposes formatting inconsistencies that frequently occur in real environments.
Understanding Wazuh Rule IDs and Decoder Hierarchy
Before writing or troubleshooting detection content, it’s helpful to understand how Wazuh organizes its rules.
Each rule is assigned a unique rule ID and may inherit logic from parent rules or depend on a specific decoder.
Understanding these relationships helps explain why:
- Certain rules never trigger
- Multiple rules match simultaneously
- Child rules inherit parent conditions
- Decoder selection affects downstream rule evaluation
A solid understanding of decoder hierarchy and rule inheritance makes interpreting Logtest output significantly easier, particularly in large environments with extensive custom detection content.

Be First to Comment