summaryrefslogtreecommitdiffstats
path: root/tests/es-duplicated-ruleset.sh
blob: b61b091adf3d5cfe70d2fd0355e0a5c0e115dca1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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