How Wazuh parses JSON logs and when teams need a Wazuh JSON decoder
Structured application and cloud logs often arrive at Wazuh as JSON objects, and the question for the team is whether those fields can be used in rules without writing a custom decoder. The answer depends on how the log reaches the Wazuh server, what the server does with the event, and whether the fields you need are already extracted. In Wazuh, the Wazuh server is the component that analyzes agent and log data with decoders and rules, while the Wazuh agent on the endpoint collects the log, the Wazuh indexer stores the resulting alerts, and the Wazuh dashboard lets analysts search and review them. Decoding happens on the server, so the server is where the parsing behavior you test and maintain lives.
Before relying on built-in parsing, confirm two things against the Wazuh documentation for the installed 4.14 release: which JSON handling applies to your log source and how the decoded fields are named when a rule references them. Exact decoder behavior, field naming and any settings for nested objects should be verified in that release rather than assumed from earlier versions. Check the Wazuh documentation for components for the component roles you will plan around, then run a few representative events through the logtest workflow to see which fields are actually populated.
Write a custom decoder when the built-in handling leaves out fields your rules need, when the log mixes a JSON payload with a plain-text prefix, or when the source uses field names that must be normalized across products. A custom decoder is also the right choice when the event must be matched on a value buried several levels deep and no existing decoder exposes it. Treat this as a planning decision: list the fields each detection needs, map them to what the server produces for a sample event, and only then decide whether the gap justifies custom decoder work and its ongoing maintenance.
How a JSON log moves from source to alert
The path starts at an application or cloud source that writes JSON lines to a file or syslog stream. A Wazuh agent or syslog collection reads the event and forwards it to the Wazuh server, where the built-in JSON decoder extracts fields and the rules engine evaluates them. A custom decoder sits in the same stage only when the format needs more than the JSON decoder provides. Check that fields arrive as expected before relying on rules, and confirm the alert reaches the Wazuh indexer and Wazuh dashboard.
Where the JSON decoder and an optional custom decoder sit in the Wazuh pipeline.
Which JSON parsing approach fits which log source
This table compares the built-in JSON decoder, a custom parent and child decoder, and a pre-processing step outside Wazuh. Read each row for the log source it suits, what it asks of your team, and the upgrade and maintenance cost it carries.
| Approach | When it fits | What it needs from you | Main maintenance and upgrade trade-off |
|---|---|---|---|
| Built-in JSON decoder | Flat or lightly nested JSON where the keys you need are stable and the events are one JSON object per line | Sample events that show the actual key names, and rules written against the decoded field paths | Low upkeep, but rules that depend on key names break quietly if the application renames or nests a field |
| Custom parent and child decoder | Vendor or in-house JSON with a fixed syslog-style header before the JSON body, or events that need extra fields pulled from a message string | Decoder files, a test set of real log lines, and wazuh-logtest runs before each deployment | Gives precise control over extracted fields, but every log format change means editing decoder files that must be retested after each Wazuh upgrade |
| Pre-processing outside Wazuh | Logs that arrive in mixed shapes, need flattening, filtering or renaming, or come from cloud sources that a shipper can already normalize | A shipper configuration under version control, a documented output schema, and a way to confirm the shipper and Wazuh agree on field names | Moves parsing logic out of Wazuh, so upgrades of Wazuh are less likely to affect it, but the shipper becomes another component to patch, monitor and keep in sync |
| Choosing for a new source | Start with the built-in decoder, and move to a custom decoder only when logtest shows fields cannot be reached cleanly | Confirm with the Wazuh documentation for your release which JSON options apply | Choosing the simplest option that works keeps the number of moving parts, and the retest burden at each upgrade, as low as possible |
Setting up JSON log ingestion step by step
This sequence takes a JSON log source from identification through collection, decoding, field checks, a nested-field rule and a dashboard alert, with a check at each stage so you know the pipeline works before you rely on it.
Identify the source and its JSON structure
The engineer who owns the application or cloud service confirms where the logs are written, whether each line is one complete JSON object, and which fields carry the event type, timestamp, user and source address. Ask for two or three representative events, including one error case, and check that every line parses as valid JSON with a JSON validator. Record field names exactly as written, because nested keys such as user.name are the paths your rules will reference. The step is done when you have a written list of required fields and sample lines that validate.
Configure collection with localfile or syslog
On the monitored host, add a localfile block to the agent configuration (or a remote syslog listener for network-sent JSON) that points at the log path and sets the log format to json. Keep the configuration in the agent group that owns the host so it is applied consistently. Restart or reload the agent according to the Wazuh documentation for your version, then confirm the agent is active in the dashboard. The step is done when the agent status shows as active and the configured log path appears in the agent's configuration view.
Confirm the JSON decoder applies
Generate one new event in the source and check the Wazuh server or archive output to see that the event was handled by the built-in JSON decoding path, not stored as an undecoded full-line message. Review the decoder name shown in the event details. If the event appears as a plain text message, check the log format setting and whether the line is complete JSON. The step is done when a fresh event shows decoded JSON fields rather than a single raw message string.
Write a sample event for testing
Save one representative event from the source as a file in your detection content repository, and keep a second sample that should not match your planned rule. Label each file with the expected outcome so reviewers can see intent. Store samples beside the rule files they test so later changes can be checked against the same input. The step is done when both samples are committed and each one has a written expected result.
Check decoded fields with wazuh-logtest
Run the sample event through wazuh-logtest on the Wazuh server and read the three phases in order: pre-decoding, decoding and rule matching. Confirm that the nested fields you listed in step one appear with the expected names and values in the decoding output. If a field is missing or has the wrong name, the JSON decoder has not produced the path your rule expects, so correct the source format or the rule before continuing. The step is done when every required field from the sample appears in the logtest output with the value you expect.
Write a rule that reads a nested field
Create a rule in a local rules file with an ID inside the custom range, set the parent decoder to the JSON decoder, and reference the nested field in the if_sid or field match using the path shown by logtest. Give the rule a level and description an analyst can act on. Keep the rule focused on one condition so tuning later stays manageable. The step is done when the rule file passes the Wazuh configuration check and logtest shows your positive sample matching the new rule and your negative sample not matching it.
Verify the alert in the dashboard
Trigger the positive event in a test environment or replay the sample through the source, then open the Wazuh dashboard and find the alert by rule ID and agent. Check that the alert shows the rule description, the level you set, and the nested field values in the event details. Confirm that the negative event produces no alert from this rule. Record the rule ID, the query you used and the alert identifier in the change record. The step is done when the alert appears with the expected fields and the negative case stays silent.
How rules reference nested JSON fields
The core point is that a rule can only match a field that the decoder has actually produced, and in Wazuh the JSON decoder turns the keys of each log object into fields that rules reference by name. Top-level keys become fields with their own names. Nested objects are addressed by joining the key path with underscores, so a value under user and then name is referenced as user_name in the rule's <field> element. Arrays need separate handling, because the field name alone does not tell you which element a value came from. The exact naming depends on the decoder and the Wazuh version in use, so the names you write in a rule should come from decoded output, not from the source application's documentation or from what the log looks like on screen.
Treat field names as something to confirm, not assume. Take a representative sample from the real source and run it through wazuh-logtest. Illustrative example: a cloud audit event with a key actor containing a nested email value and an array of roles might decode to a field such as actor_email while the array elements are not addressable the way you expect. A rule written against actor.email or actor_email could silently never fire, and the only symptom would be missing alerts. Record the decoded field names for each event type you care about, and check the value types and whether a field is present when optional keys are absent.
Before deploying any rule that depends on nested or array values, run every expected sample event and a few malformed or incomplete ones through logtest, confirm the decoded fields and the matched rule ID, and keep those samples with the rule file so a later change can be retested. Ask the team that owns the log source whether the schema changes across versions or tenants, because a renamed key will break matching without any error. If a field you need does not appear reliably in decoded output, that is the signal to move to a custom decoder rather than writing a fragile rule against an inconsistent structure.
When a custom decoder is still needed
The Wazuh JSON decoder handles well-formed JSON events, but many application and cloud logs arrive wrapped in prefixes, mixed with other formats, or split across lines. The cards below describe the situations where a custom decoder or a preprocessing step is still needed, and what to check before writing one.
Non-JSON prefixes and mixed formats
Many sources write a syslog header, a timestamp, or a tag in front of the JSON body, so the line does not start with a brace. The JSON decoder then sees an invalid document. Check the first characters of a raw event in a sample file before assuming the JSON decoder will match. The usual fix is a parent decoder that matches the prefix and hands the remaining JSON string to a child decoder, with the prefix fields extracted separately.
Vulnerability detection docsFields that need renaming or splitting
The JSON decoder maps keys to fields using the names the application emits, so a key such as usr.id or a combined value like user@host may not be usable in rules as-is. A field containing several values, such as a request path with a query string, needs to be split before a rule can match on one part. Decide which field names rules will reference, then confirm with logtest that each one is populated.
Multi-line events
Stack traces, multi-line audit records and pretty-printed JSON arrive as several lines, and the agent forwards each line as a separate event by default. A JSON parser cannot rebuild the full document from fragments. Confirm how the source writes its output and whether it can emit one event per line. If it cannot, the fix is usually to change the logging configuration at the source, since reassembling lines on the manager is fragile.
In-house application structure
Internal applications often nest arrays of objects, repeat keys at several depths, or use field names that change between releases. A custom decoder can pin the expected structure and fail visibly when a field is missing. Ask the application team for a schema or a set of representative events, including error cases, and build test samples from them before writing rules.
Unsupported device and vendor formats
Some firewalls, appliances and cloud services emit key-value pairs, CEF, or proprietary text that merely contains some JSON. Wazuh may already ship a decoder for the product, but it can be outdated after a firmware or API change. Compare a current sample against the shipped decoder with logtest. If fields are missing, a custom child decoder that extends the existing parse is usually less risky than replacing it.
Questions teams ask before parsing JSON logs in Wazuh
How much effort does a JSON log integration in Wazuh take?
The effort depends mainly on how stable the log schema is and how many fields your rules need. Wazuh's built-in JSON handling parses well-formed JSON without a custom decoder, so a simple source with a fixed schema is usually a small task. Effort rises when events mix formats, when field names differ between versions of the same application, when timestamps need conversion, or when many distinct event types each need their own rules. Ask any partner to break the work into sources, event types and rules, and to state which of those items are included in the quote.
Can our internal team parse JSON logs in Wazuh without a partner?
Yes, if the team has someone comfortable with JSON, Wazuh rule syntax and a Linux shell. The core work is configuring the log source, confirming the JSON is parsed, and writing rules against fields such as those exposed by the decoder. Teams without that skill often underestimate testing and the path from a single source to many. A partner is most useful for a planned rollout across several sources, a review of the rule design, or knowledge transfer. Whichever route you take, confirm that someone on your team will own the content after handover.
What do we need to provide for a JSON logging integration?
Three inputs shape the work more than anything else. First, representative sample logs for each event type, including error cases and optional fields, because the decoder and rules are only as good as the samples they were built from. Second, a named owner in the application or cloud team who can confirm schema changes and answer questions about field meaning. Third, a test environment with a Wazuh server where you can send sample events, check decoding and confirm which rules fire before anything reaches production. Also ask who approves rule changes and who maintains them after go-live.
How long does a JSON parsing project take in Wazuh?
Duration scales with the number of sources, the number of event types per source and the complexity of the rules you need. A single source with a stable schema and a few detections is much shorter than a set of applications that each emit dozens of event types. Access delays also matter: waiting for sample logs, approvals or a test environment often takes longer than the parsing work itself. Ask for a timeline that lists each source, its event types, the test cycles and the points where your team must respond. No duration should be accepted without that breakdown.
When is a custom decoder worth maintaining for JSON logs?
A custom decoder earns its maintenance cost when the built-in JSON handling cannot extract what your rules need. Typical triggers include a JSON payload wrapped inside a syslog header or other prefix that must be removed first, events that mix JSON with plain text, or fields that need to be pulled out of a string before rules can match them. If the built-in parsing already exposes the fields you need, a custom decoder adds a file to maintain without adding detection value. Test that claim with sample logs in logtest before writing one.
What happens to custom JSON rules and decoders during a Wazuh upgrade?
Custom content lives in files that you manage separately from the default ruleset, so it is designed to survive upgrades when it is placed in the locations Wazuh documents for local content. The risk is behavioral rather than file loss: a new release can change default rules, decoders or field names that your custom rules depend on. Before each upgrade, retest your sample logs against the new version, check that rule IDs you use do not collide with defaults, and review the release notes for changes that touch decoding. Confirm the exact file locations and upgrade steps against the current Wazuh documentation for your version.
Official Wazuh documentation for JSON and decoder work
Start with the Wazuh components documentation, because it settles where JSON parsing happens before you change any configuration. Wazuh has four components: the Wazuh indexer stores alerts, the Wazuh server analyzes agent data with decoders and rules, the Wazuh dashboard is the web interface, and Wazuh agents run on endpoints. For JSON application and cloud logs, the agent or a syslog or API collection path moves the raw event to the server, and the server's decoders and rules turn its fields into values your rules can match. Confirm that split in your own environment before deciding where a custom decoder belongs, because a field your rule needs is only available at the stage that extracts it. The server can run as a cluster, so also confirm how your custom decoder and rule files reach every node that processes the same logs.
Next, pin the exact version you run and read the Wazuh release notes for that version. The current release line is 4.14, and Wazuh 4.14.9 was released on 14 October 2026, following 4.14.8 on 23 September 2026. Wazuh shipped 4.14 patch releases on 17 March, 23 April, 1 July, 29 July, 23 September and 14 October 2026, roughly one every one to two months. That cadence means a JSON decoding behavior you verified on one patch can change within weeks, so record the version next to every test result and review the notes again whenever you upgrade. Record the exact patch version with every decoder test, and have your team confirm any decoder behavior against the notes for its version before it reaches production.
Finally, match the documentation to how you installed the platform. Wazuh documents all-in-one and step-by-step installation, a prebuilt OVA virtual machine, an Amazon Machine Image, Docker, Kubernetes, an offline installation guide, installation from sources, Ansible and Puppet, and the deployment options page lists each path. File locations for custom decoders and rules, service restart steps and the place where you stage sample logs can differ between these methods, so check the page for your method before you copy any example path. If the server has no internet access, follow the offline guide for the installation and confirm how decoder and rule updates reach it. Write down the installation method and version your team uses, so the next engineer reads the same documentation you did.
How DeployOpen works on this
DeployOpen plans JSON log parsing in Wazuh as part of a fixed-scope engagement inside your own infrastructure. We start from the log samples your applications and cloud services actually produce, then decide which fields the built-in decoder handles and which need custom work before any rule depends on them.
How we scope
- We inventory the JSON log sources, their producers and the fields your rules need to match.
- We confirm which events the built-in JSON decoder handles and which need a custom decoder.
- The written scope lists sources, decoders, rules, test samples, deliverables and the agreed timeline.
How we build
- We collect representative sample logs, including nested objects, optional fields and malformed lines.
- We write and test decoders and rules with wazuh-logtest against those samples before deployment.
- We keep custom rule IDs within the local ranges so default content can still be upgraded safely.
How we hand over
- You receive the decoder and rule files, the sample logs used for testing and the expected results.
- We document the field mappings so analysts can see which JSON keys feed which rule conditions.
- Your team walks through the test cases and the steps to add a new JSON source.
How we support
- Ongoing support and continuous testing are available as a retainer for parsing changes after handover.
- Retesting covers the sample set when application log formats change or Wazuh is upgraded.
- We can help your team review new JSON sources before they reach production alerting.

