Skip to content

Wazuh

XplicitTrust provides a custom decoder and ruleset for Wazuh.

In short

Relay the forwarder's syslog over TLS to the manager with a TLS-terminating relay, install the two XplicitTrust files (decoder and rules) on the manager, and add a forwarder in the console. Every event then becomes an alert under the rule ids 117000 to 117299; Detections lists them.

Goal

The event forwarder sends the JSON message body as one xplicittrust object, and the decoder extracts every field of it into data.xplicittrust.*, apart from the fields of other log sources. The rules generate alerts per event type, with compliance tags for PCI DSS, GDPR, HIPAA and NIST 800-53 where applicable, and with the MITRE ATT&CK technique where an event corresponds to one (brute force, impaired defenses, use of valid accounts).

Architecture

XplicitTrust ──TLS :6514──▶ TLS-terminating relay ──syslog──▶ Wazuh manager
                            (stunnel + rsyslog or syslog-ng)

Wazuh does not accept RFC 5425 syslog over TLS directly, so a relay terminates TLS in front of the manager.

Prerequisites

  • A Wazuh manager.
  • A host for the relay, reachable from the internet on TCP port 6514, with a DNS name and a certificate from a publicly trusted CA. The event forwarder does not accept self-signed certificates.
  • rsyslog or syslog-ng on the relay, and stunnel or another TLS termination.

Steps

  1. Set up the TLS relay and raise its message size limit; see TLS relay and message size.
  2. Install the decoder and rules on the manager; see Decoder and rules.
  3. Add the event forwarder in the Admin Console under Settings → SIEM → Event Forwarders:

    Field Value
    Protocol Syslog over TLS
    URL <relay name>:6514
    Framing Octet counting (RFC 5425)
    Event Filters none, so the heartbeats and every event type arrive
  4. Optional: index alerts at the original event time, map the source address and monitor the heartbeats; see Optional settings.

TLS relay and message size

Wazuh does not accept RFC 5425 syslog over TLS directly. Terminate TLS in front of the manager (e.g. stunnel) and relay the messages with rsyslog or syslog-ng to the manager's syslog input. Use the default Octet counting (RFC 5425) framing on the forwarder.

Raise the relay's message size limit to Wazuh's own (64 KB). rsyslog cuts messages off at 8 KB by default, and a cut-off message has invalid JSON: Wazuh then stores it under the base rule with no decoded fields. Most events are well below 2 KB, but a configuration change with many changed fields or a network discovery summary with many hosts can be larger. In rsyslog, set the limit at the top of /etc/rsyslog.conf, before any module is loaded:

global(maxMessageSize="64k")

Verify

Press Send Test Event for the forwarder in the console. In the Wazuh dashboard, an alert of rule 117104 (Test event sent with Send Test Event) appears, with the decoded fields under data.xplicittrust.*. Heartbeats (rule 117086) are not stored.

Decoder and rules

Copy the files to /var/ossec/etc/decoders/ and /var/ossec/etc/rules/ respectively, then restart the Wazuh manager.

The rules use the ids 117000 to 117299, a block inside the range Wazuh reserves for custom rules (100000 to 120000) and away from its start, where hand-written rules usually begin. If your own rules already use ids in this block, shift all ids in the file by the same amount: the rules refer to each other by id.

Upgrading from 0585-xplicittrust_rules.xml

Before release 1.137 the event fields were at the top level of the JSON body (data.event_type), the rule ids started at 100100, and the files were named 0585-xplicittrust_*.xml. The old files do not match the new body: remove both, install the two files above, and change data.created_at to data.xplicittrust.created_at in the ingest pipeline if you index alerts at their original event time. Also replace the heartbeat check script with the current one. Alerts indexed before the change keep their old field names and rule ids, so update saved searches, dashboards and table columns to the new names; they then show new alerts only.

The rules set no_full_log: an alert carries the decoded fields (data.xplicittrust.*) and not, a second time, the raw JSON line they were decoded from. The exception is the base rule 117000, which fires when no other rule matches: an event type the rules do not know yet, or a message whose JSON could not be decoded. Its alerts keep the raw line in full_log, because for a message that could not be decoded it is the only copy of the event.

Optional settings

These three settings make Wazuh show alerts at the time the event happened, on the map, and tell you when a forwarder stops.

Original Event Time

Wazuh sets an alert's timestamp to the moment the event was processed by the analysis engine, not the time the event occurred. A relay in front of the manager (rsyslog forwarding by default) also downgrades the message to RFC 3164, which drops the year and the time zone from the syslog header. Under normal operation the difference is a few seconds. After a forwarder outage, however, the event forwarder replays the entire backlog on recovery, and all replayed alerts then show the recovery time -- even though each message carries the original event time in the data.xplicittrust.created_at field.

To index alerts at their original event time instead, override the alert timestamp in the Filebeat ingest pipeline on the Wazuh manager:

  1. Edit /usr/share/filebeat/module/wazuh/alerts/ingest/pipeline.json and insert this processor into the processors array, immediately before the existing date processor. It has to come after the json processor at the top of the array, which is what unpacks the alert and makes data.xplicittrust.created_at available:

    {
      "set": {
        "if": "ctx.data?.xplicittrust?.created_at != null",
        "field": "timestamp",
        "value": "{{data.xplicittrust.created_at}}"
      }
    }
    
  2. Reload the pipeline and restart Filebeat:

    filebeat setup --pipelines
    systemctl restart filebeat
    
  3. Verify the pipeline before relying on it. Its failure handler drops any alert it cannot process, so a mistake shows up as missing alerts rather than as an error message. Simulate the pipeline with a document that carries data.xplicittrust.created_at; the pipeline name is filebeat-<Filebeat version>-wazuh-alerts-pipeline:

    curl -sk -u admin:<indexer password> -H 'Content-Type: application/json' \
      'https://127.0.0.1:9200/_ingest/pipeline/filebeat-7.10.2-wazuh-alerts-pipeline/_simulate?verbose=true' \
      -d '{"docs":[{"_source":{"message":"{\"timestamp\":\"2026-10-15T17:38:52.953+0200\",\"data\":{\"xplicittrust\":{\"created_at\":\"2026-10-15T17:38:47.989Z\"}}}","fields":{"index_prefix":"wazuh-alerts-4.x-"}}}]}'
    

    Every processor must report "status" : "success". After the set step the document's timestamp must equal the created_at value, and the date_index_name step must show an _index with the event's date (2026.10.15 in this example), not the processing date.

Since both the date processor (which sets @timestamp) and the date_index_name processor (which selects the daily index) read the timestamp field, alerts are indexed at their true event time and land in the correct daily indices. The millisecond precision of created_at is what makes this work with the stock pipeline: date_index_name expects yyyy-MM-dd'T'HH:mm:ss.SSSXX by default and would drop a timestamp without a fractional part.

Notes:

  • The override only applies to alerts that carry data.xplicittrust.created_at -- XplicitTrust events. Alerts from other sources are unaffected.
  • Alerts indexed before the change keep their processing time; only new alerts get the event time.
  • The on-disk archives (/var/ossec/logs/alerts/alerts.json) still record the processing time; only the indexed documents change.
  • The processing time is not kept in the indexed document once overridden -- if you need both times, leave the pipeline unmodified and query data.xplicittrust.created_at directly instead.
  • Delivery is at-least-once: after an outage an event can arrive twice. Two alerts with the same data.xplicittrust.event_id are the same event.

Source Address Location

The Wazuh dashboards place an alert on the map by its GeoLocation field, which the Filebeat ingest pipeline fills from the source address fields of the log sources Wazuh ships support for. To have it filled for XplicitTrust events as well, add one processor for data.xplicittrust.remote_address:

  1. Edit /usr/share/filebeat/module/wazuh/alerts/ingest/pipeline.json and insert this processor into the processors array, next to the existing geoip processors:

    {
      "geoip": {
        "field": "data.xplicittrust.remote_address",
        "target_field": "GeoLocation",
        "properties": ["city_name", "country_name", "region_name", "location"],
        "ignore_missing": true,
        "ignore_failure": true
      }
    }
    
  2. Reload the pipeline and restart Filebeat:

    filebeat setup --pipelines
    systemctl restart filebeat
    

Notes:

  • GeoLocation comes from the indexer's own GeoIP database. The event's data.xplicittrust.city and data.xplicittrust.country are what XplicitTrust looked up when the event was written; the two can differ slightly.
  • Events without a public address get no GeoLocation: private addresses, and events the server raises on its own (remote_address is unknown). They are indexed as before.
  • A Wazuh upgrade can replace pipeline.json. Check after an upgrade that this processor and the one for the original event time are still there.

Heartbeat Monitoring

A forwarder that is cut off sends nothing, and Wazuh rules fire only on events that arrive. To notice a stopped feed, forwarders send an event_forwarder.heartbeat every five minutes, with or without other events. Rule 117086 matches heartbeats at level 0, so they are not stored. The heartbeat check below notices when they stop: it raises rule 117087 when a forwarder that sent heartbeats has been silent for 20 minutes, and rule 117088 once it is sending again.

A forwarder that is disabled, deleted or redirected delivers that change to its old destination before it stops (rules 117101 to 117103). The check does not also report it as missing.

The check is a Python 3 script without dependencies. It needs the heartbeats and forwarder changes in a file, which the relay in front of the manager writes:

  1. In the rsyslog ruleset that relays the forwarder's messages to the manager, write heartbeats and forwarder changes to a file before relaying them:

    template(name="XplicitTrustForwarderState" type="string"
        string="%hostname% %msg%\n")
    
    # inside the ruleset, before the action that relays to the manager
    if $app-name == "xplicittrust" and
       ($msgid == "event_forwarder.heartbeat" or
        (($msgid == "configuration_change.updated" or $msgid == "configuration_change.deleted") and
         $msg contains "\"object_type\":\"event_forwarder\"")) then {
        action(type="omfile" file="/var/log/xplicittrust-forwarders.log"
               fileCreateMode="0640" template="XplicitTrustForwarderState")
    }
    

    Check the configuration with rsyslogd -N1, then restart rsyslog.

  2. Install xplicittrust-heartbeat-check as /usr/local/bin/xplicittrust-heartbeat-check (mode 0755) and run it every five minutes, for example from cron:

    */5 * * * * root /usr/local/bin/xplicittrust-heartbeat-check
    

    It keeps its state in /var/lib/xplicittrust-heartbeat/ and appends its findings to /var/log/xplicittrust-heartbeat-check.log, once per change of state.

  3. Let the manager read the findings. Add to /var/ossec/etc/ossec.conf and restart the manager:

    <localfile>
      <log_format>syslog</log_format>
      <location>/var/log/xplicittrust-heartbeat-check.log</location>
    </localfile>
    
  4. Rotate both files. The script reads the forwarder file and its first rotation (.1), so keep one uncompressed rotation:

    /var/log/xplicittrust-forwarders.log {
        daily
        rotate 1
        missingok
        notifempty
        postrotate
            /usr/lib/rsyslog/rsyslog-rotate
        endscript
    }
    
    /var/log/xplicittrust-heartbeat-check.log {
        weekly
        rotate 4
        missingok
        notifempty
        compress
        delaycompress
    }
    

Notes:

  • The check only watches forwarders it has received a heartbeat from. It stays quiet until the first heartbeat arrives, and forgets a forwarder after seven days of silence.
  • A silent forwarder is reported once. If your manager sends alerts by email, add <options>alert_by_email</options> to rules 117087, 117101 and 117102, or set email_alert_level to 12 or lower.
  • The check runs on the manager and cannot tell you when the manager itself stops. Monitor the manager from outside as well.

The rule set alerts on every event type and correlates failed logins, logins from two countries, mass deletion, protections switched off and more. The rules, their levels and the MITRE ATT&CK techniques are in Detections. If your manager sends alerts by email, see the note at the end of Heartbeat monitoring for the rules that should reach someone.

Troubleshooting

What you see Cause and fix
Alerts under rule 117000 with no decoded fields and the raw line in full_log The message was cut off on the way, or has an event type the rules do not know yet. Raise the relay's message size limit to 64 KB, and update the rules for a new event type.
After an upgrade from release 1.136 or older, alerts do not match the rules The event fields moved under xplicittrust and the rule ids changed. Replace the old files; see the note under Decoder and rules.
After a forwarder outage, the backlog alerts show the recovery time Wazuh stamps alerts when it processes them. See Original event time.
The same data.xplicittrust.event_id appears twice Delivery is at-least-once. The two alerts are the same event.
Rule 117087 fires A forwarder that sent heartbeats has been silent for 20 minutes; see Heartbeat monitoring.

See also