summaryrefslogtreecommitdiffstats
path: root/tests/es-duplicated-ruleset.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:28:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 16:28:20 +0000
commitdcc721a95bef6f0d8e6d8775b8efe33e5aecd562 (patch)
tree66a2774cd0ee294d019efd71d2544c70f42b2842 /tests/es-duplicated-ruleset.sh
parentInitial commit. (diff)
downloadrsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.tar.xz
rsyslog-dcc721a95bef6f0d8e6d8775b8efe33e5aecd562.zip
Adding upstream version 8.2402.0.upstream/8.2402.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/es-duplicated-ruleset.sh')
-rwxr-xr-xtests/es-duplicated-ruleset.sh44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/es-duplicated-ruleset.sh b/tests/es-duplicated-ruleset.sh
new file mode 100755
index 0000000..b61b091
--- /dev/null
+++ b/tests/es-duplicated-ruleset.sh
@@ -0,0 +1,44 @@
+#!/bin/bash
+# The sole purpose of this test is to check that rsyslog "survives" the
+# duplicate ruleset definition and emits the proper error message. So we
+# do NOT need to have elasticsearch running to carry it out. We avoid
+# sending data to ES as this complicates things more than needed.
+# This is based on a real case, see
+# https://github.com/rsyslog/rsyslog/pull/3796
+# Thanks to Noriko Hosoi for providing the original test idea which
+# was then modified by Rainer Gerhards.
+# This file is part of the rsyslog project, released under ASL 2.0
+. ${srcdir:=.}/diag.sh init
+export ES_PORT=19200
+export QUEUE_EMPTY_CHECK_FUNC=es_shutdown_empty_check
+generate_conf
+add_conf '
+template(name="tpl" type="string" string="{\"msgnum\":\"%msg:F,58:2%\"}")
+
+module(load="../plugins/omelasticsearch/.libs/omelasticsearch")
+ruleset(name="try_es") {
+ action(type="omelasticsearch"
+ server="localhost"
+ serverport=`echo $ES_PORT`
+ template="tpl"
+ searchIndex="rsyslog_testbench"
+ retryruleset="try_es"
+ )
+}
+
+ruleset(name="try_es") {
+ action(type="omelasticsearch"
+ server="localhost"
+ serverport=`echo $ES_PORT`
+ template="tpl"
+ searchIndex="rsyslog_testbench"
+ retryruleset="try_es"
+ )
+}
+action(type="omfile" file="'$RSYSLOG_OUT_LOG'")
+'
+startup
+shutdown_immediate
+wait_shutdown
+content_check "ruleset 'try_es' specified more than once"
+exit_test