Where alerts disappear between Filebeat and the indexer in Wazuh 4.14: pipeline, template and on_failure
The Wazuh 4.14 alert pipeline ends in on_failure with drop, so a faulty document vanishes without an error. Template, setup.template and how to count the loss.
An alert that reached alerts.json does not have to reach the wazuh-alerts-4.x-* index. The Wazuh module pipeline for Filebeat ends in an on_failure block with a drop processor, so a document the pipeline cannot process disappears without an error. Other documents fall out later, at mapping time. You can measure both, but not with the counters you would reach for first.
The module files come from wazuh/wazuh at tag v4.14.11. Wazuh indexer 4.14.11 is built on OpenSearch 2.19.7, and the Wazuh 4.x package repository ships filebeat-oss-7.10.2, so I checked the behavior of both programs in the code of those versions. The data in the examples is synthetic: alerts.json, the counters and the _count responses are sample files, and the output blocks come from running the scripts (bash 5.3, jq 1.8) on them. I did not run the indexer queries (_simulate, the pipeline lookup with a wildcard) against a real indexer; their expected results come from the OpenSearch documentation and code.
The path of an alert from file to index
The wazuh module reads the file named in manifest.yml and passes the index prefix to the pipeline, and the pipeline picks the name of the daily index. Default values from the 4.14.11 code:
| Item | Value |
|---|---|
paths (default) | /var/ossec/logs/alerts/alerts.json |
index_prefix (default) | wazuh-alerts-4.x- |
ingest_pipeline | ingest/pipeline.json |
index_patterns in the template | wazuh-alerts-4.x-* and wazuh-archives-4.x-* |
The pipeline has 30 processors. The first is json on the message field with add_to_root, then two set processors for AWS fields, ten geoip, date, date_index_name and fifteen remove processors that clean up Filebeat technical fields. Only three processors lack ignore_failure: true:
| Processor | What it does | ignore_failure |
|---|---|---|
json | unpacks message into the document root | not set, so by default an error stops the pipeline |
date | timestamp to @timestamp, format ISO8601 | false |
date_index_name | index name from timestamp, rounding d, format yyyy.MM.dd | false |
So a file line that is not valid JSON, a document without timestamp and a document whose timestamp is not ISO8601 all stop the pipeline. The Wazuh file sets no timezone on date_index_name, so OpenSearch computes the index day in UTC (that comes from reading the code, not from a test). The connection from Filebeat to the indexer on TCP 9200 is one of the four connections in the Wazuh architecture flow. What analysisd writes to the file is covered by the post on archives and alerts, and events lost before the rules even run by the post on analysisd.
on_failure with drop at the end of the pipeline
The last lines of pipeline.json in the 4.14.11 code:
"on_failure" : [{
"drop" : { }
}]
OpenSearch has three ways to react to a processor error. ignore_failure skips the error and moves on. on_failure on a processor runs repair processors and also moves on. on_failure at the pipeline level runs when a processor without its own handling fails, and then the pipeline stops. With none of these, a processor error fails the whole pipeline and the document is not indexed.
In the Wazuh pipeline, an error in json, date or date_index_name therefore ends in drop, which discards the document without raising an error. A write of such a document gets "result": "noop", "_version": -3 and _shards with total equal to 0, so neither the client nor the OpenSearch log sees a failure. OpenSearch also lets on_failure change _index and route faulty documents to a separate index for review and reloading. The Wazuh pipeline does not do that, and there is no index of dropped documents.
You can reproduce the failure on a single document. Filebeat 7.10.2 names the module pipeline filebeat-<version>-wazuh-alerts-pipeline, which for the 7.10.2 package is filebeat-7.10.2-wazuh-alerts-pipeline (that comes from reading the code, not from a test). Look up the name on your indexer with GET /_ingest/pipeline/*wazuh* (the query accepts a wildcard) and put it in the path:
POST /_ingest/pipeline/<pipeline-id>/_simulate
{
"docs": [
{
"_source": {
"message": "{\"timestamp\":\"2026-12-01T11:30:00.404+00",
"fields": { "index_prefix": "wazuh-alerts-4.x-" }
}
}
]
}
For a document dropped by drop, the docs array in the response contains null. Add verbose=true to see the result of each processor and find the one that failed.
Rejections at mapping time
The Wazuh template from the repository sets date_detection to false and has no dynamic key, so unknown fields get dynamic mappings. It also has one dynamic template, string_as_keyword, which maps strings to keyword. Fields that matter for alerts have explicit types: rule.level is long, while rule.id and agent.id are keyword. For dynamically mapped fields the first document decides. A JSON integer produces long, and a later document with non-numeric text in that field will not get in.
A document that does not match the mapping passes the pipeline cleanly and fails only on write. Unlike drop, this error shows up in the bulk response: errors is true, and the document’s item carries a 4xx status and the reason. Filebeat 7.10.2 treats item statuses differently. It retries 429 and 5xx errors, and that is what the documentation means when it says Filebeat ignores max_retries and retries indefinitely. It counts a 409 as a duplicate (a document with the same ID under a create operation) and does not log it. Any other 4xx is a permanent failure: Filebeat logs a Cannot index event ... (status=400) warning with the reason and drops the event without retrying (that comes from reading the code, not from a test). bulk_max_size defaults to 50.
The template also sets index.mapping.total_fields.limit to 10000. OpenSearch rejects a document that would add a field past that limit with Limit of total fields [10000] has been exceeded. That is a 4xx error, so it takes the same path: a warning in the Filebeat log and a lost event (that comes from reading the code, not from a test). A template change affects only new indices and leaves existing ones as they are.
setup.template in filebeat.yml
The sample filebeat.yml from packages.wazuh.com/4.14 loads JSON from disk and does not set setup.template.overwrite:
setup.template.json.enabled: true
setup.template.json.path: '/etc/filebeat/wazuh-template.json'
setup.template.json.name: 'wazuh'
setup.ilm.overwrite: true
setup.ilm.enabled: false
setup.template.overwrite decides whether Filebeat overwrites an existing template at startup, and it defaults to false: a template already on the indexer stays, and the log shows Template wazuh already exists and will not be overwritten.. The Filebeat documentation advises against enabling the option when more than one instance runs, and in a manager cluster every node runs its own Filebeat. The sample file respects that. You update the template explicitly with the commands from the guide, covered in the post on the 4.14 upgrade:
filebeat setup --pipelines
filebeat setup --index-management -E output.logstash.enabled=false
filebeat setup --index-management always overwrites the template, whatever setup.template.overwrite says, and it needs the Elasticsearch output enabled. Without it the command fails with Index management requested but the Elasticsearch output is not configured/enabled (that comes from reading the code, not from a test). The new template applies to indices created after the command, which usually means from the next day.
The same filebeat.yml has logging.metrics.enabled: false. By default Filebeat logs changes to its counters every logging.metrics.period (30 s). The sample Wazuh file turns that off, so /var/log/filebeat/filebeat has no publishing counters. The names of those metrics are not documented and may change between versions.
How to count the loss
The checks go from the source to the index. Each one narrows down where documents disappear.
1. Lines the pipeline will not process
The script reads alerts.json line by line and prints the lines that fail the checks of the json, date and date_index_name processors. The regular expression is a rough test of the ISO8601 prefix, not a replacement for the Elasticsearch parser.
#!/usr/bin/env bash
# List lines the Wazuh alerts pipeline cannot handle: invalid JSON,
# missing or non-string timestamp, timestamp that does not look like ISO8601.
set -euo pipefail
jq -R -c '
. as $line
| (try fromjson catch null) as $doc
| if ($doc | type) != "object" then {line: $line[0:40], problem: "not valid JSON"}
elif ($doc.timestamp | type) != "string" then {id: $doc.id, problem: "no string timestamp"}
elif ($doc.timestamp | test("^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}") | not)
then {id: $doc.id, problem: "timestamp not ISO8601-like", timestamp: $doc.timestamp}
else empty end' "$1"
Result on a sample file with seven lines:
{"line":"{\"timestamp\":\"2026-12-01T11:30:00.404+00","problem":"not valid JSON"}
{"id":"5","problem":"no string timestamp"}
{"id":"6","problem":"timestamp not ISO8601-like","timestamp":"01/12/2026 12:00"}
2. Document count in the daily index
GET /{index}/_count returns the number of documents in an index. Save the responses for full, finished days to count-YYYY.MM.dd.json files and compare them with the line count in the file:
#!/usr/bin/env bash
# Usage: compare.sh alerts.json count-2026.12.01.json count-2026.12.02.json
set -euo pipefail
alerts=$1; shift
for resp in "$@"; do
day=${resp#count-}; day=${day%.json}
iso=${day//./-}
in_file=$(jq -R -r --arg d "$iso" 'try (fromjson | (.timestamp // empty | strings | select(startswith($d)))) catch empty' "$alerts" | wc -l | tr -d ' ')
in_index=$(jq '.count' "$resp")
echo "$iso file=$in_file index=$in_index missing=$((in_file - in_index))"
done
2026-12-01 file=3 index=2 missing=1
2026-12-02 file=1 index=1 missing=0
Lines with broken JSON have no date, so in this comparison step 1 accounts for them. The script takes the date from the timestamp text, while the daily index is built from the UTC day. If the manager writes timestamp with an offset other than +0000, lines from the hours between local midnight and UTC midnight land in the neighboring index. Compare closed days, and check a difference at a day boundary before you call it a loss.
3. Processor counters in OpenSearch
GET /_nodes/stats/ingest returns ingest.total, pipelines._id_.count and pipelines._id_.failed for each pipeline, and per-processor counters under pipelines._id_.processors. For the Wazuh pipeline the pipeline-level counters will not show drops: on_failure with drop handles the error, so neither pipelines._id_.failed nor ingest.total.failed goes up. Only the failed counter of the processor that failed increases (that comes from reading the OpenSearch 2.19.7 code, not from a test). Save two samples some time apart and compute the difference for the three processors without ignore_failure:
#!/usr/bin/env bash
# Delta of the failed counters of the json, date and date_index_name processors
# between two saved _nodes/stats/ingest responses.
set -euo pipefail
jq -nc --slurpfile a "$1" --slurpfile b "$2" '
def flat: [ .nodes | to_entries[] | .key as $n | .value.ingest.pipelines | to_entries[]
| .key as $p | .value.processors | to_entries[] | .key as $i | .value | to_entries[0]
| select(.value.type | IN("json", "date", "date_index_name"))
| {k: "\($n)/\($p)/\($i)", pipeline: "\($n)/\($p)", processor: .key, failed: .value.stats.failed} ];
($a[0] | flat) as $old
| $b[0] | flat[] | . as $x | ($old[] | select(.k == $x.k)) as $o
| select($x.failed > $o.failed)
| {pipeline: $x.pipeline, processor: $x.processor, failed: ($x.failed - $o.failed)}'
{"pipeline":"node-a/filebeat-7.10.2-wazuh-alerts-pipeline","processor":"json","failed":7}
{"pipeline":"node-a/filebeat-7.10.2-wazuh-alerts-pipeline","processor":"date","failed":5}
The sum of these differences is the number of documents drop discarded in that interval. The counters live in the node’s memory and reset when it restarts, so a sample from before a restart is useless for comparison. Replacing the pipeline, for example with PUT _ingest/pipeline/<id>, carries the processor counters over only when the new version has the same number of processors of the same types in the same order; otherwise they start from zero (that comes from reading the code, not from a test). Each indexer node counts only the documents it processed itself, which is why the script reports each node separately.
4. Filebeat log
The default level is info, and the file sits in /var/log/filebeat with seven rotated copies (keepfiles: 7). filebeat test output checks the connection to the indexer. Search the log for Cannot index event: these are documents rejected at mapping time, including the field limit, which Filebeat dropped without retrying. Documents discarded by drop will not be there, because the indexer answers them without an error.
Keeping track of the loss day to day
The vendor does not describe such a procedure; this one follows from the mechanisms above.
- Once a day, run the step 1 script on the previous day’s file. Any output means the pipeline will drop at least one document, so look for the cause in the source or the decoder.
- Compare the step 2 numbers for closed days and record the difference with the date, so you can see a trend.
- Collect the counter differences from step 3 and the
Cannot index eventwarnings from step 4. The first count drops in the pipeline, the second rejections at mapping time. - After every decoder change, check one document with
_simulateand make suredocscontains nonull. - For upgrades, use the
filebeat setupcommands from the guide instead of enablingsetup.template.overwritein a configuration that runs on many nodes.
Sources
- https://raw.githubusercontent.com/wazuh/wazuh/v4.14.11/extensions/filebeat/7.x/wazuh-module/alerts/ingest/pipeline.json
- https://raw.githubusercontent.com/wazuh/wazuh/v4.14.11/extensions/filebeat/7.x/wazuh-module/alerts/manifest.yml
- https://raw.githubusercontent.com/wazuh/wazuh/v4.14.11/extensions/elasticsearch/7.x/wazuh-template.json
- https://raw.githubusercontent.com/wazuh/wazuh-indexer/v4.14.11/buildSrc/version.properties
- https://packages.wazuh.com/4.14/tpl/wazuh/filebeat/filebeat.yml
- https://documentation.wazuh.com/4.14/upgrade-guide/upgrading-central-components.html
- https://www.elastic.co/guide/en/beats/filebeat/7.10/configuration-template.html
- https://www.elastic.co/guide/en/beats/filebeat/7.10/elasticsearch-output.html
- https://www.elastic.co/guide/en/beats/filebeat/7.10/configuration-logging.html
- https://raw.githubusercontent.com/elastic/beats/v7.10.2/libbeat/outputs/elasticsearch/client.go
- https://raw.githubusercontent.com/elastic/beats/v7.10.2/libbeat/cmd/instance/beat.go
- https://raw.githubusercontent.com/elastic/beats/v7.10.2/libbeat/idxmgmt/std.go
- https://raw.githubusercontent.com/elastic/beats/v7.10.2/libbeat/template/load.go
- https://raw.githubusercontent.com/elastic/beats/v7.10.2/filebeat/fileset/fileset.go
- https://raw.githubusercontent.com/opensearch-project/OpenSearch/2.19.7/server/src/main/java/org/opensearch/ingest/Pipeline.java
- https://raw.githubusercontent.com/opensearch-project/OpenSearch/2.19.7/server/src/main/java/org/opensearch/ingest/CompoundProcessor.java
- https://raw.githubusercontent.com/opensearch-project/OpenSearch/2.19.7/server/src/main/java/org/opensearch/ingest/IngestService.java
- https://raw.githubusercontent.com/opensearch-project/OpenSearch/2.19.7/server/src/main/java/org/opensearch/ingest/IngestStats.java
- https://raw.githubusercontent.com/opensearch-project/OpenSearch/2.19.7/modules/ingest-common/src/main/java/org/opensearch/ingest/common/DateIndexNameProcessor.java
- https://raw.githubusercontent.com/opensearch-project/OpenSearch/2.19.7/server/src/main/java/org/opensearch/index/mapper/MappingLookup.java
- https://docs.opensearch.org/latest/ingest-pipelines/pipeline-failures/
- https://docs.opensearch.org/latest/ingest-pipelines/processors/drop/
- https://docs.opensearch.org/latest/api-reference/nodes-apis/nodes-stats/
- https://docs.opensearch.org/latest/api-reference/document-apis/bulk/
- https://docs.opensearch.org/latest/api-reference/search-apis/count/
- https://docs.opensearch.org/latest/mappings/