rsyslog/tests/es-basic-abort.sh
Rainer Gerhards 5bb8eb9179
omelasticsearch: omit _type by default; use typeless endpoint
Newer Elasticsearch versions reject typed APIs. This adapts the module
so shipping works out of the box with modern clusters and keeps the
codebase aligned with typeless ES conventions.

Impact: bulk metadata no longer includes _type unless explicitly set.
Old setups that relied on a default "events" type (ES < 8) may need
explicit configuration.

Technically, the default searchType is now NULL
(OMES_SEARCHTYPE_DEFAULT). setPostURL continues to route requests to
the typeless /_doc endpoint, but bulk metadata is generated without a
_type field when searchType is unset. The legacy default "events" for
ES < 8 is removed. Tests are updated to stop passing searchType, and
the searchType-empty test is dropped to reflect the new default. No
OMODTX or action-queue semantics change.

Closes: https://github.com/rsyslog/rsyslog/issues/5060
2025-09-25 11:56:32 +02:00

46 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
# This file is part of the rsyslog project, released under ASL 2.0
. ${srcdir:=.}/diag.sh init
export NUMMESSAGES=1000
ensure_elasticsearch_ready
generate_conf
add_conf '
template(name="tpl" type="string"
string="{\"msgnum\":\"%msg:F,58:2%\"}")
module(load="../plugins/omelasticsearch/.libs/omelasticsearch")
if $msg contains "msgnum:" then {
action(type="omelasticsearch"
server="127.0.0.1"
serverport="19200"
template="tpl"
action.resumeRetryCount="-1"
action.resumeInterval="1"
searchIndex="rsyslog_testbench")
# this action just to count processed messages
action(type="omfile" file="'$RSYSLOG_DYNNAME'.syncfile")
}
'
startup
injectmsg 0 $NUMMESSAGES
wait_file_lines $RSYSLOG_DYNNAME.syncfile $NUMMESSAGES
echo stop elasticsearch...
stop_elasticsearch
injectmsg $NUMMESSAGES 1000
NUMMESSAGES=$(( NUMMESSAGES + 1000 ))
echo start elasticsearch...
start_elasticsearch
wait_file_lines $RSYSLOG_DYNNAME.syncfile $NUMMESSAGES
shutdown_when_empty
wait_shutdown
./msleep 1000 # ES might need some time to maintain index...
es_getdata $(( NUMMESSAGES + 2000 )) 19200
#stop_elasticsearch
seq_check 0 $((NUMMESSAGES - 1)) -d
cleanup_elasticsearch
exit_test