From aa0b3e4657decc6ceff380c344532beac16dc416 Mon Sep 17 00:00:00 2001 From: Florian Riedl Date: Tue, 24 Jul 2018 13:05:02 +0200 Subject: [PATCH] Test refactor part 2 --- tests/msgvar-concurrency-array-event.tags.sh | 21 ++++++- tests/msgvar-concurrency-array.sh | 21 ++++++- tests/msgvar-concurrency.sh | 20 ++++++- tests/multiple_lookup_tables.sh | 14 ++++- tests/mysql-actq-mt-withpause-extended.sh | 17 +++++- tests/mysql-actq-mt-withpause-vg.sh | 17 +++++- tests/mysql-actq-mt-withpause.sh | 17 +++++- tests/mysql-actq-mt.sh | 17 +++++- tests/mysql-asyn-vg.sh | 9 ++- tests/mysql-asyn.sh | 9 ++- tests/mysql-basic-cnf6.sh | 10 +++- tests/mysql-basic-vg.sh | 7 ++- tests/mysql-basic.sh | 7 ++- tests/no-dynstats-json.sh | 12 +++- tests/no-dynstats.sh | 12 +++- tests/now-utc.sh | 12 +++- tests/now_family_utc.sh | 12 +++- tests/omprog-close-unresponsive-noterm.sh | 26 +++++++- tests/omprog-close-unresponsive-vg.sh | 26 +++++++- tests/omprog-close-unresponsive.sh | 26 +++++++- tests/omprog-feedback-vg.sh | 22 ++++++- tests/omprog-feedback.sh | 22 ++++++- tests/omprog-restart-terminated-outfile.sh | 24 +++++++- tests/omprog-restart-terminated-vg.sh | 23 ++++++- tests/omprog-restart-terminated.sh | 23 ++++++- tests/omprog-transactions-failed-commits.sh | 23 ++++++- tests/omprog-transactions-failed-messages.sh | 23 ++++++- tests/omprog-transactions-vg.sh | 25 +++++++- tests/omprog-transactions.sh | 25 +++++++- tests/omruleset-queue.sh | 21 ++++++- tests/omruleset.sh | 17 +++++- tests/pgsql-basic-vg.sh | 7 ++- tests/pgsql-basic.sh | 7 ++- tests/pgsql-template-vg.sh | 10 +++- tests/pgsql-template.sh | 10 +++- tests/pipe_noreader.sh | 11 +++- tests/pipeaction.sh | 17 +++++- tests/prop-all-json-concurrency.sh | 22 ++++++- tests/queue-persist-drvr.sh | 23 ++++++- tests/random.sh | 17 +++++- tests/rawmsg-after-pri.sh | 11 +++- tests/rfc5424parser.sh | 13 +++- tests/rs_optimizer_pri.sh | 12 +++- tests/rscript_contains.sh | 7 ++- tests/rscript_eq.sh | 17 +++++- tests/rscript_eq_var.sh | 60 ++++++++++++++++++- tests/rscript_field-vg.sh | 14 ++++- tests/rscript_field.sh | 14 ++++- tests/rscript_ge.sh | 16 ++++- tests/rscript_ge_var.sh | 63 +++++++++++++++++++- tests/rscript_gt.sh | 15 ++++- tests/rscript_gt_var.sh | 57 +++++++++++++++++- tests/rscript_hash32-vg.sh | 15 ++++- tests/rscript_hash32.sh | 15 ++++- tests/rscript_hash64-vg.sh | 15 ++++- tests/rscript_hash64.sh | 15 ++++- tests/rscript_le.sh | 15 ++++- tests/rscript_le_var.sh | 63 +++++++++++++++++++- tests/rscript_lt.sh | 15 ++++- tests/rscript_lt_var.sh | 57 +++++++++++++++++- tests/rscript_ne.sh | 21 ++++++- tests/rscript_ne_var.sh | 63 +++++++++++++++++++- tests/rscript_optimizer1.sh | 15 ++++- tests/rscript_prifilt.sh | 13 +++- tests/rscript_random.sh | 13 +++- tests/rscript_re_extract.sh | 13 +++- tests/rscript_re_match.sh | 13 +++- tests/rscript_replace.sh | 17 +++++- tests/rscript_replace_complex.sh | 16 ++++- tests/rscript_ruleset_call.sh | 25 +++++++- tests/rscript_set_modify.sh | 15 ++++- tests/rscript_stop.sh | 16 ++++- tests/rscript_stop2.sh | 21 ++++++- tests/rscript_unaffected_reset.sh | 15 ++++- tests/rscript_wrap2.sh | 13 +++- tests/rscript_wrap3.sh | 13 +++- tests/rsf_getenv.sh | 17 +++++- tests/rulesetmultiqueue-v6.sh | 36 ++++++++++- tests/rulesetmultiqueue.sh | 36 ++++++++++- tests/sparse_array_lookup_table-vg.sh | 14 ++++- tests/sparse_array_lookup_table.sh | 14 ++++- tests/stats-cee-vg.sh | 14 ++++- tests/stats-cee.sh | 14 ++++- tests/stats-json-es.sh | 14 ++++- tests/stats-json-vg.sh | 14 ++++- tests/stats-json.sh | 14 ++++- 86 files changed, 1595 insertions(+), 87 deletions(-) diff --git a/tests/msgvar-concurrency-array-event.tags.sh b/tests/msgvar-concurrency-array-event.tags.sh index 2db8245d3..259edbb25 100755 --- a/tests/msgvar-concurrency-array-event.tags.sh +++ b/tests/msgvar-concurrency-array-event.tags.sh @@ -6,7 +6,26 @@ export TCPFLOOD_EXTRA_OPTS="-M'msg:msg: 1:2, 3:4, 5:6, 7:8 b test'" echo =============================================================================== echo \[msgvar-concurrency-array-event.tags.sh\]: testing concurrency of local variables . $srcdir/diag.sh init -startup msgvar-concurrency-array-event.tags.conf +generate_conf +add_conf ' +module(load="../plugins/mmnormalize/.libs/mmnormalize") +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +template(name="outfmt" type="string" string="%$!%\n") + +#action(type="omfile" file="rsyslog2.out.log" template="outfmt" queue.type="linkedList") +action(type="mmnormalize" ruleBase="testsuites/msgvar-concurrency-array-event.tags.rulebase") +if $msg contains "msg:" then { +# set $!tree!here!nbr = field($msg, 58, 2); # Delimiter = : + action(type="omfile" file="rsyslog2.out.log" template="outfmt" queue.type="linkedList") + set $!tree!here!save = $!tree!here!nbr; + set $!tree!here!nbr = ""; + set $!tree!here!nbr = $!tree!here!save; + action(type="omfile" file="rsyslog.out.log" template="outfmt" queue.type="linkedList") +} +' +startup sleep 1 . $srcdir/diag.sh tcpflood -m500000 shutdown_when_empty # shut down rsyslogd when done processing messages diff --git a/tests/msgvar-concurrency-array.sh b/tests/msgvar-concurrency-array.sh index 8b6389db8..1081fa56d 100755 --- a/tests/msgvar-concurrency-array.sh +++ b/tests/msgvar-concurrency-array.sh @@ -6,7 +6,26 @@ export TCPFLOOD_EXTRA_OPTS="-M'msg:msg: 1:2, 3:4, 5:6, 7:8 b test'" echo =============================================================================== echo \[msgvar-concurrency-array.sh\]: testing concurrency of local variables . $srcdir/diag.sh init -startup msgvar-concurrency-array.conf +generate_conf +add_conf ' +module(load="../plugins/mmnormalize/.libs/mmnormalize") +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +template(name="outfmt" type="string" string="%$!%\n") + +#action(type="omfile" file="rsyslog2.out.log" template="outfmt" queue.type="linkedList") +action(type="mmnormalize" ruleBase="testsuites/msgvar-concurrency-array.rulebase") +if $msg contains "msg:" then { +# set $!tree!here!nbr = field($msg, 58, 2); # Delimiter = : + action(type="omfile" file="rsyslog2.out.log" template="outfmt" queue.type="linkedList") + set $!tree!here!save = $!tree!here!nbr; + set $!tree!here!nbr = ""; + set $!tree!here!nbr = $!tree!here!save; + action(type="omfile" file="rsyslog.out.log" template="outfmt" queue.type="linkedList") +} +' +startup sleep 1 . $srcdir/diag.sh tcpflood -m500000 shutdown_when_empty # shut down rsyslogd when done processing messages diff --git a/tests/msgvar-concurrency.sh b/tests/msgvar-concurrency.sh index b9c79e191..eadbd726e 100755 --- a/tests/msgvar-concurrency.sh +++ b/tests/msgvar-concurrency.sh @@ -12,7 +12,25 @@ if [ `uname` = "SunOS" ] ; then fi . $srcdir/diag.sh init -startup msgvar-concurrency.conf +generate_conf +add_conf ' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +template(name="outfmt" type="string" string="%$!tree!here!nbr%\n") + +if $msg contains "msgnum:" then { + set $!tree!here!nbr = field($msg, 58, 2); + action(type="omfile" file="rsyslog2.out.log" template="outfmt" + queue.type="linkedList") + + set $!tree!here!save = $!tree!here!nbr; + set $!tree!here!nbr = ""; + set $!tree!here!nbr = $!tree!here!save; + action(type="omfile" file="rsyslog.out.log" template="outfmt") +} +' +startup sleep 1 . $srcdir/diag.sh tcpflood -m500000 shutdown_when_empty # shut down rsyslogd when done processing messages diff --git a/tests/multiple_lookup_tables.sh b/tests/multiple_lookup_tables.sh index 3239345c7..622462a13 100755 --- a/tests/multiple_lookup_tables.sh +++ b/tests/multiple_lookup_tables.sh @@ -11,9 +11,21 @@ fi echo =============================================================================== echo \[multiple_lookup_table.sh\]: test for multiple lookup-table and HUP based reloading of it . $srcdir/diag.sh init +generate_conf +add_conf ' +lookup_table(name="xlate_0" file="xlate.lkp_tbl") +lookup_table(name="xlate_1" file="xlate_1.lkp_tbl") + +template(name="outfmt" type="string" string="- %msg% 0_%$.lkp_0% 1_%$.lkp_1%\n") + +set $.lkp_0 = lookup("xlate_0", $msg); +set $.lkp_1 = lookup("xlate_1", $msg); + +action(type="omfile" file="./rsyslog.out.log" template="outfmt") +' cp -f $srcdir/testsuites/xlate.lkp_tbl xlate.lkp_tbl cp -f $srcdir/testsuites/xlate.lkp_tbl xlate_1.lkp_tbl -startup multiple_lookup_tables.conf +startup . $srcdir/diag.sh injectmsg 0 3 . $srcdir/diag.sh wait-queueempty . $srcdir/diag.sh content-check "msgnum:00000000: 0_foo_old 1_foo_old" diff --git a/tests/mysql-actq-mt-withpause-extended.sh b/tests/mysql-actq-mt-withpause-extended.sh index 764cfb8b1..21cc2aca4 100755 --- a/tests/mysql-actq-mt-withpause-extended.sh +++ b/tests/mysql-actq-mt-withpause-extended.sh @@ -4,8 +4,23 @@ echo =============================================================================== echo \[mysql-act-mt.sh\]: test for mysql with multithread actionq . $srcdir/diag.sh init +generate_conf +add_conf ' +module(load="../plugins/ommysql/.libs/ommysql") + +:msg, contains, "msgnum:" { + action(type="ommysql" server="127.0.0.1" + db="Syslog" uid="rsyslog" pwd="testbench" + queue.size="10000" queue.type="linkedList" + queue.workerthreads="5" + queue.workerthreadMinimumMessages="500" + queue.timeoutWorkerthreadShutdown="100" + queue.timeoutEnqueue="10000" + ) +} +' mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql -startup mysql-actq-mt-withpause-extended.conf +startup let "strtnum = 0" diff --git a/tests/mysql-actq-mt-withpause-vg.sh b/tests/mysql-actq-mt-withpause-vg.sh index b27e1339d..b05da35c6 100755 --- a/tests/mysql-actq-mt-withpause-vg.sh +++ b/tests/mysql-actq-mt-withpause-vg.sh @@ -3,8 +3,23 @@ echo =============================================================================== echo \[mysql-act-mt.sh\]: test for mysql with multithread actionq . $srcdir/diag.sh init +generate_conf +add_conf ' +module(load="../plugins/ommysql/.libs/ommysql") + +:msg, contains, "msgnum:" { + action(type="ommysql" server="127.0.0.1" + db="Syslog" uid="rsyslog" pwd="testbench" + queue.size="10000" queue.type="linkedList" + queue.workerthreads="5" + queue.workerthreadMinimumMessages="500" + queue.timeoutWorkerthreadShutdown="1000" + queue.timeoutEnqueue="10000" + ) +} +' mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql -startup_vg mysql-actq-mt.conf +startup_vg . $srcdir/diag.sh injectmsg 0 50000 . $srcdir/diag.sh wait-queueempty echo waiting for worker threads to timeout diff --git a/tests/mysql-actq-mt-withpause.sh b/tests/mysql-actq-mt-withpause.sh index 32a5b813b..8a152b3e9 100755 --- a/tests/mysql-actq-mt-withpause.sh +++ b/tests/mysql-actq-mt-withpause.sh @@ -3,8 +3,23 @@ echo =============================================================================== echo \[mysql-act-mt.sh\]: test for mysql with multithread actionq . $srcdir/diag.sh init +generate_conf +add_conf ' +module(load="../plugins/ommysql/.libs/ommysql") + +:msg, contains, "msgnum:" { + action(type="ommysql" server="127.0.0.1" + db="Syslog" uid="rsyslog" pwd="testbench" + queue.size="10000" queue.type="linkedList" + queue.workerthreads="5" + queue.workerthreadMinimumMessages="500" + queue.timeoutWorkerthreadShutdown="1000" + queue.timeoutEnqueue="10000" + ) +} +' mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql -startup mysql-actq-mt.conf +startup . $srcdir/diag.sh injectmsg 0 50000 . $srcdir/diag.sh wait-queueempty echo waiting for worker threads to timeout diff --git a/tests/mysql-actq-mt.sh b/tests/mysql-actq-mt.sh index 7cabad901..01564c95c 100755 --- a/tests/mysql-actq-mt.sh +++ b/tests/mysql-actq-mt.sh @@ -3,8 +3,23 @@ echo =============================================================================== echo \[mysql-act-mt.sh\]: test for mysql with multithread actionq . $srcdir/diag.sh init +generate_conf +add_conf ' +module(load="../plugins/ommysql/.libs/ommysql") + +:msg, contains, "msgnum:" { + action(type="ommysql" server="127.0.0.1" + db="Syslog" uid="rsyslog" pwd="testbench" + queue.size="10000" queue.type="linkedList" + queue.workerthreads="5" + queue.workerthreadMinimumMessages="500" + queue.timeoutWorkerthreadShutdown="1000" + queue.timeoutEnqueue="10000" + ) +} +' mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql -startup mysql-actq-mt.conf +startup . $srcdir/diag.sh injectmsg 0 150000 shutdown_when_empty wait_shutdown diff --git a/tests/mysql-asyn-vg.sh b/tests/mysql-asyn-vg.sh index 42792a2b2..9af8439e9 100755 --- a/tests/mysql-asyn-vg.sh +++ b/tests/mysql-asyn-vg.sh @@ -3,8 +3,15 @@ echo =============================================================================== echo \[mysql-asyn.sh\]: asyn test for mysql functionality . $srcdir/diag.sh init +generate_conf +add_conf ' +$ModLoad ../plugins/ommysql/.libs/ommysql +$ActionQueueType LinkedList +$ActionQueueTimeoutEnqueue 10000 # 10 second to make sure we do not loose due to action q full +:msg, contains, "msgnum:" :ommysql:127.0.0.1,Syslog,rsyslog,testbench; +' mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql -startup_vg mysql-asyn.conf +startup_vg . $srcdir/diag.sh injectmsg 0 50000 shutdown_when_empty wait_shutdown_vg diff --git a/tests/mysql-asyn.sh b/tests/mysql-asyn.sh index 8b7af5c42..a52db4656 100755 --- a/tests/mysql-asyn.sh +++ b/tests/mysql-asyn.sh @@ -3,8 +3,15 @@ echo =============================================================================== echo \[mysql-asyn.sh\]: asyn test for mysql functionality . $srcdir/diag.sh init +generate_conf +add_conf ' +$ModLoad ../plugins/ommysql/.libs/ommysql +$ActionQueueType LinkedList +$ActionQueueTimeoutEnqueue 10000 # 10 second to make sure we do not loose due to action q full +:msg, contains, "msgnum:" :ommysql:127.0.0.1,Syslog,rsyslog,testbench; +' mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql -startup mysql-asyn.conf +startup . $srcdir/diag.sh injectmsg 0 50000 shutdown_when_empty wait_shutdown diff --git a/tests/mysql-basic-cnf6.sh b/tests/mysql-basic-cnf6.sh index 906fb369f..96ec32155 100755 --- a/tests/mysql-basic-cnf6.sh +++ b/tests/mysql-basic-cnf6.sh @@ -3,8 +3,16 @@ echo =============================================================================== echo \[mysql-basic.sh\]: basic test for mysql-basic functionality . $srcdir/diag.sh init +generate_conf +add_conf ' +$ModLoad ../plugins/ommysql/.libs/ommysql +if $msg contains 'msgnum' then { + action(type="ommysql" server="127.0.0.1" + db="Syslog" uid="rsyslog" pwd="testbench") +} +' mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql -startup mysql-basic-cnf6.conf +startup . $srcdir/diag.sh injectmsg 0 5000 shutdown_when_empty wait_shutdown diff --git a/tests/mysql-basic-vg.sh b/tests/mysql-basic-vg.sh index 1f2b212f5..eb4895388 100755 --- a/tests/mysql-basic-vg.sh +++ b/tests/mysql-basic-vg.sh @@ -3,8 +3,13 @@ echo =============================================================================== echo \[mysql-basic-vg.sh\]: basic test for mysql-basic functionality/valgrind . $srcdir/diag.sh init +generate_conf +add_conf ' +$ModLoad ../plugins/ommysql/.libs/ommysql +:msg, contains, "msgnum:" :ommysql:127.0.0.1,Syslog,rsyslog,testbench; +' mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql -startup_vg mysql-basic.conf +startup_vg . $srcdir/diag.sh injectmsg 0 5000 shutdown_when_empty wait_shutdown_vg diff --git a/tests/mysql-basic.sh b/tests/mysql-basic.sh index 7b9c9db5f..8e31efc51 100755 --- a/tests/mysql-basic.sh +++ b/tests/mysql-basic.sh @@ -3,8 +3,13 @@ echo =============================================================================== echo \[mysql-basic.sh\]: basic test for mysql-basic functionality . $srcdir/diag.sh init +generate_conf +add_conf ' +$ModLoad ../plugins/ommysql/.libs/ommysql +:msg, contains, "msgnum:" :ommysql:127.0.0.1,Syslog,rsyslog,testbench; +' mysql --user=rsyslog --password=testbench < testsuites/mysql-truncate.sql -startup mysql-basic.conf +startup . $srcdir/diag.sh injectmsg 0 5000 shutdown_when_empty wait_shutdown diff --git a/tests/no-dynstats-json.sh b/tests/no-dynstats-json.sh index f72ca1219..7bbd2b553 100755 --- a/tests/no-dynstats-json.sh +++ b/tests/no-dynstats-json.sh @@ -4,7 +4,17 @@ echo =============================================================================== echo \[no-dynstats-json.sh\]: test for verifying stats are reported correctly in json format in absence of any dynstats buckets being configured . $srcdir/diag.sh init -startup no-dynstats-json.conf +generate_conf +add_conf ' +ruleset(name="stats") { + action(type="omfile" file="./rsyslog.out.stats.log") +} + +module(load="../plugins/impstats/.libs/impstats" interval="1" severity="7" resetCounters="on" Ruleset="stats" bracketing="on" format="json") + +action(type="omfile" file="./rsyslog.out.log") +' +startup . $srcdir/diag.sh wait-for-stats-flush 'rsyslog.out.stats.log' echo doing shutdown shutdown_when_empty diff --git a/tests/no-dynstats.sh b/tests/no-dynstats.sh index e4d176456..f3dc956f3 100755 --- a/tests/no-dynstats.sh +++ b/tests/no-dynstats.sh @@ -4,7 +4,17 @@ echo =============================================================================== echo \[no-dynstats.sh\]: test for verifying stats are reported correctly in legacy format in absence of any dynstats buckets being configured . $srcdir/diag.sh init -startup no-dynstats.conf +generate_conf +add_conf ' +ruleset(name="stats") { + action(type="omfile" file="./rsyslog.out.stats.log") +} + +module(load="../plugins/impstats/.libs/impstats" interval="1" severity="7" resetCounters="on" Ruleset="stats" bracketing="on") + +action(type="omfile" file="./rsyslog.out.log") +' +startup . $srcdir/diag.sh wait-for-stats-flush 'rsyslog.out.stats.log' echo doing shutdown shutdown_when_empty diff --git a/tests/now-utc.sh b/tests/now-utc.sh index 1305733c8..722ec6c07 100755 --- a/tests/now-utc.sh +++ b/tests/now-utc.sh @@ -4,12 +4,22 @@ # requires faketime echo \[now-utc\]: test \$NOW-UTC . $srcdir/diag.sh init +generate_conf +add_conf ' +$ModLoad ../plugins/imtcp/.libs/imtcp +$InputTCPServerRun 13514 + +template(name="outfmt" type="string" + string="%$now%,%$now-utc%\n") +:msg, contains, "msgnum:" action(type="omfile" template="outfmt" + file="rsyslog.out.log") +' . $srcdir/faketime_common.sh export TZ=TEST-02:00 -FAKETIME='2016-01-01 01:00:00' startup now-utc.conf +FAKETIME='2016-01-01 01:00:00' startup # what we send actually is irrelevant, as we just use system properties. # but we need to send one message in order to gain output! . $srcdir/diag.sh tcpflood -m1 diff --git a/tests/now_family_utc.sh b/tests/now_family_utc.sh index dfd68cd50..729a15c31 100755 --- a/tests/now_family_utc.sh +++ b/tests/now_family_utc.sh @@ -4,12 +4,22 @@ # requires faketime echo \[now_family_utc\]: test \$NOW family of system properties . $srcdir/diag.sh init +generate_conf +add_conf ' +$ModLoad ../plugins/imtcp/.libs/imtcp +$InputTCPServerRun 13514 + +template(name="outfmt" type="string" + string="%$hour%:%$minute%,%$hour-utc%:%$minute-utc%\n") +:msg, contains, "msgnum:" action(type="omfile" template="outfmt" + file="rsyslog.out.log") +' . $srcdir/faketime_common.sh export TZ=TEST+06:30 -FAKETIME='2016-01-01 01:00:00' startup now_family_utc.conf +FAKETIME='2016-01-01 01:00:00' startup # what we send actually is irrelevant, as we just use system properties. # but we need to send one message in order to gain output! . $srcdir/diag.sh tcpflood -m1 diff --git a/tests/omprog-close-unresponsive-noterm.sh b/tests/omprog-close-unresponsive-noterm.sh index faed18e9d..48da5c00a 100755 --- a/tests/omprog-close-unresponsive-noterm.sh +++ b/tests/omprog-close-unresponsive-noterm.sh @@ -6,7 +6,31 @@ # the unresponsive child if killUnresponsive=on. . $srcdir/diag.sh init -startup omprog-close-unresponsive-noterm.conf +generate_conf +add_conf ' +module(load="../plugins/omprog/.libs/omprog") + +template(name="outfmt" type="string" string="%msg%\n") + +main_queue( + queue.timeoutShutdown="60000" # give time to omprog to wait for the child +) + +:msg, contains, "msgnum:" { + action( + type="omprog" + binary=`echo $srcdir/testsuites/omprog-close-unresponsive-bin.sh` + template="outfmt" + name="omprog_action" + queue.type="Direct" # the default; facilitates sync with the child process + confirmMessages="on" # facilitates sync with the child process + signalOnClose="off" + closeTimeout="1000" # ms + killUnresponsive="on" # default value: the value of signalOnClose + ) +} +' +startup . $srcdir/diag.sh wait-startup . $srcdir/diag.sh injectmsg 0 10 . $srcdir/diag.sh wait-queueempty diff --git a/tests/omprog-close-unresponsive-vg.sh b/tests/omprog-close-unresponsive-vg.sh index 32edc2832..940390d07 100755 --- a/tests/omprog-close-unresponsive-vg.sh +++ b/tests/omprog-close-unresponsive-vg.sh @@ -6,7 +6,31 @@ # rest of checks (this simplifies the maintenance of the tests). . $srcdir/diag.sh init -startup_vg omprog-close-unresponsive.conf +generate_conf +add_conf ' +module(load="../plugins/omprog/.libs/omprog") + +template(name="outfmt" type="string" string="%msg%\n") + +main_queue( + queue.timeoutShutdown="60000" # give time to omprog to wait for the child +) + +:msg, contains, "msgnum:" { + action( + type="omprog" + binary=`echo $srcdir/testsuites/omprog-close-unresponsive-bin.sh` + template="outfmt" + name="omprog_action" + queue.type="Direct" # the default; facilitates sync with the child process + confirmMessages="on" # facilitates sync with the child process + signalOnClose="on" + closeTimeout="1000" # ms + #killUnresponsive="on" # default value: the value of signalOnClose + ) +} +' +startup_vg . $srcdir/diag.sh wait-startup . $srcdir/diag.sh injectmsg 0 10 . $srcdir/diag.sh wait-queueempty diff --git a/tests/omprog-close-unresponsive.sh b/tests/omprog-close-unresponsive.sh index eaddc7f37..f9fdf3ff0 100755 --- a/tests/omprog-close-unresponsive.sh +++ b/tests/omprog-close-unresponsive.sh @@ -6,7 +6,31 @@ # child if unresponsive. . $srcdir/diag.sh init -startup omprog-close-unresponsive.conf +generate_conf +add_conf ' +module(load="../plugins/omprog/.libs/omprog") + +template(name="outfmt" type="string" string="%msg%\n") + +main_queue( + queue.timeoutShutdown="60000" # give time to omprog to wait for the child +) + +:msg, contains, "msgnum:" { + action( + type="omprog" + binary=`echo $srcdir/testsuites/omprog-close-unresponsive-bin.sh` + template="outfmt" + name="omprog_action" + queue.type="Direct" # the default; facilitates sync with the child process + confirmMessages="on" # facilitates sync with the child process + signalOnClose="on" + closeTimeout="1000" # ms + #killUnresponsive="on" # default value: the value of signalOnClose + ) +} +' +startup . $srcdir/diag.sh wait-startup . $srcdir/diag.sh injectmsg 0 10 . $srcdir/diag.sh wait-queueempty diff --git a/tests/omprog-feedback-vg.sh b/tests/omprog-feedback-vg.sh index 992c01f69..4c7fc5169 100755 --- a/tests/omprog-feedback-vg.sh +++ b/tests/omprog-feedback-vg.sh @@ -6,7 +6,27 @@ # rest of checks (this simplifies the maintenance of the tests). . $srcdir/diag.sh init -startup_vg omprog-feedback.conf +generate_conf +add_conf ' +module(load="../plugins/omprog/.libs/omprog") + +template(name="outfmt" type="string" string="%msg%\n") + +:msg, contains, "msgnum:" { + action( + type="omprog" + binary=`echo $srcdir/testsuites/omprog-feedback-bin.sh` + template="outfmt" + name="omprog_action" + queue.type="Direct" # the default; facilitates sync with the child process + confirmMessages="on" + useTransactions="off" + action.resumeRetryCount="10" + action.resumeInterval="1" + ) +} +' +startup_vg . $srcdir/diag.sh wait-startup . $srcdir/diag.sh injectmsg 0 10 . $srcdir/diag.sh wait-queueempty diff --git a/tests/omprog-feedback.sh b/tests/omprog-feedback.sh index f700f133e..3dc12bf23 100755 --- a/tests/omprog-feedback.sh +++ b/tests/omprog-feedback.sh @@ -6,7 +6,27 @@ # it has failed to process. . $srcdir/diag.sh init -startup omprog-feedback.conf +generate_conf +add_conf ' +module(load="../plugins/omprog/.libs/omprog") + +template(name="outfmt" type="string" string="%msg%\n") + +:msg, contains, "msgnum:" { + action( + type="omprog" + binary=`echo $srcdir/testsuites/omprog-feedback-bin.sh` + template="outfmt" + name="omprog_action" + queue.type="Direct" # the default; facilitates sync with the child process + confirmMessages="on" + useTransactions="off" + action.resumeRetryCount="10" + action.resumeInterval="1" + ) +} +' +startup . $srcdir/diag.sh wait-startup . $srcdir/diag.sh injectmsg 0 10 . $srcdir/diag.sh wait-queueempty diff --git a/tests/omprog-restart-terminated-outfile.sh b/tests/omprog-restart-terminated-outfile.sh index 46111dd06..02cffc336 100755 --- a/tests/omprog-restart-terminated-outfile.sh +++ b/tests/omprog-restart-terminated-outfile.sh @@ -6,9 +6,31 @@ # descriptors handled by omprog. . $srcdir/diag.sh init +generate_conf +add_conf ' +module(load="../plugins/omprog/.libs/omprog") + +template(name="outfmt" type="string" string="%msg%\n") + +:msg, contains, "msgnum:" { + action( + type="omprog" + binary=`echo $srcdir/testsuites/omprog-restart-terminated-bin.sh` + template="outfmt" + name="omprog_action" + queue.type="Direct" # the default; facilitates sync with the child process + confirmMessages="on" # facilitates sync with the child process + action.resumeRetryCount="10" + action.resumeInterval="1" + action.reportSuspensionContinuation="on" + signalOnClose="off" + output="./rsyslog.omprog.out.log" + ) +} +' . $srcdir/diag.sh check-command-available lsof -startup omprog-restart-terminated-outfile.conf +startup . $srcdir/diag.sh wait-startup . $srcdir/diag.sh injectmsg 0 1 . $srcdir/diag.sh wait-queueempty diff --git a/tests/omprog-restart-terminated-vg.sh b/tests/omprog-restart-terminated-vg.sh index b7c8d3e5a..f50d10ac5 100755 --- a/tests/omprog-restart-terminated-vg.sh +++ b/tests/omprog-restart-terminated-vg.sh @@ -6,7 +6,28 @@ # rest of checks (this simplifies the maintenance of the tests). . $srcdir/diag.sh init -startup_vg omprog-restart-terminated.conf +generate_conf +add_conf ' +module(load="../plugins/omprog/.libs/omprog") + +template(name="outfmt" type="string" string="%msg%\n") + +:msg, contains, "msgnum:" { + action( + type="omprog" + binary=`echo $srcdir/testsuites/omprog-restart-terminated-bin.sh` + template="outfmt" + name="omprog_action" + queue.type="Direct" # the default; facilitates sync with the child process + confirmMessages="on" # facilitates sync with the child process + action.resumeRetryCount="10" + action.resumeInterval="1" + action.reportSuspensionContinuation="on" + signalOnClose="off" + ) +} +' +startup_vg . $srcdir/diag.sh wait-startup . $srcdir/diag.sh injectmsg 0 1 . $srcdir/diag.sh wait-queueempty diff --git a/tests/omprog-restart-terminated.sh b/tests/omprog-restart-terminated.sh index fff0ad700..17fdcbcfd 100755 --- a/tests/omprog-restart-terminated.sh +++ b/tests/omprog-restart-terminated.sh @@ -9,9 +9,30 @@ # is expecting the program to confirm the last message). . $srcdir/diag.sh init +generate_conf +add_conf ' +module(load="../plugins/omprog/.libs/omprog") + +template(name="outfmt" type="string" string="%msg%\n") + +:msg, contains, "msgnum:" { + action( + type="omprog" + binary=`echo $srcdir/testsuites/omprog-restart-terminated-bin.sh` + template="outfmt" + name="omprog_action" + queue.type="Direct" # the default; facilitates sync with the child process + confirmMessages="on" # facilitates sync with the child process + action.resumeRetryCount="10" + action.resumeInterval="1" + action.reportSuspensionContinuation="on" + signalOnClose="off" + ) +} +' . $srcdir/diag.sh check-command-available lsof -startup omprog-restart-terminated.conf +startup . $srcdir/diag.sh wait-startup . $srcdir/diag.sh injectmsg 0 1 . $srcdir/diag.sh wait-queueempty diff --git a/tests/omprog-transactions-failed-commits.sh b/tests/omprog-transactions-failed-commits.sh index f6f6f9a4c..12e70921e 100755 --- a/tests/omprog-transactions-failed-commits.sh +++ b/tests/omprog-transactions-failed-commits.sh @@ -6,6 +6,27 @@ # transaction commits. . $srcdir/diag.sh init +generate_conf +add_conf ' +module(load="../plugins/omprog/.libs/omprog") + +template(name="outfmt" type="string" string="%msg%\n") + +:msg, contains, "msgnum:" { + action( + type="omprog" + binary=`echo $srcdir/testsuites/omprog-transactions-bin.sh --failed_commits` + template="outfmt" + name="omprog_action" + queue.type="Direct" # the default; facilitates sync with the child process + queue.dequeueBatchSize="6" + confirmMessages="on" + useTransactions="on" + action.resumeRetryCount="10" + action.resumeInterval="1" + ) +} +' uname if [ `uname` = "SunOS" ] ; then @@ -16,7 +37,7 @@ if [ `uname` = "SunOS" ] ; then exit 77 fi -startup omprog-transactions-failed-commits.conf +startup . $srcdir/diag.sh wait-startup . $srcdir/diag.sh injectmsg 0 10 . $srcdir/diag.sh wait-queueempty diff --git a/tests/omprog-transactions-failed-messages.sh b/tests/omprog-transactions-failed-messages.sh index 3322447bc..78753a8a1 100755 --- a/tests/omprog-transactions-failed-messages.sh +++ b/tests/omprog-transactions-failed-messages.sh @@ -6,7 +6,28 @@ # messages. . $srcdir/diag.sh init -startup omprog-transactions-failed-messages.conf +generate_conf +add_conf ' +module(load="../plugins/omprog/.libs/omprog") + +template(name="outfmt" type="string" string="%msg%\n") + +:msg, contains, "msgnum:" { + action( + type="omprog" + binary=`echo $srcdir/testsuites/omprog-transactions-bin.sh --failed_messages` + template="outfmt" + name="omprog_action" + queue.type="Direct" # the default; facilitates sync with the child process + queue.dequeueBatchSize="6" + confirmMessages="on" + useTransactions="on" + action.resumeRetryCount="10" + action.resumeInterval="1" + ) +} +' +startup . $srcdir/diag.sh wait-startup . $srcdir/diag.sh injectmsg 0 10 . $srcdir/diag.sh wait-queueempty diff --git a/tests/omprog-transactions-vg.sh b/tests/omprog-transactions-vg.sh index 879f948a6..91af0eeec 100755 --- a/tests/omprog-transactions-vg.sh +++ b/tests/omprog-transactions-vg.sh @@ -6,7 +6,30 @@ # rest of checks (this simplifies the maintenance of the tests). . $srcdir/diag.sh init -startup_vg omprog-transactions.conf +generate_conf +add_conf ' +module(load="../plugins/omprog/.libs/omprog") + +template(name="outfmt" type="string" string="%msg%\n") + +:msg, contains, "msgnum:" { + action( + type="omprog" + binary=`echo $srcdir/testsuites/omprog-transactions-bin.sh` + template="outfmt" + name="omprog_action" + queue.type="Direct" # the default; facilitates sync with the child process + queue.dequeueBatchSize="6" + confirmMessages="on" + useTransactions="on" + beginTransactionMark="BEGIN TRANSACTION" + commitTransactionMark="COMMIT TRANSACTION" + action.resumeRetryCount="10" + action.resumeInterval="1" + ) +} +' +startup_vg . $srcdir/diag.sh wait-startup . $srcdir/diag.sh injectmsg 0 10 . $srcdir/diag.sh wait-queueempty diff --git a/tests/omprog-transactions.sh b/tests/omprog-transactions.sh index a085bb1a3..a0be4a767 100755 --- a/tests/omprog-transactions.sh +++ b/tests/omprog-transactions.sh @@ -6,7 +6,30 @@ # and transactions. . $srcdir/diag.sh init -startup omprog-transactions.conf +generate_conf +add_conf ' +module(load="../plugins/omprog/.libs/omprog") + +template(name="outfmt" type="string" string="%msg%\n") + +:msg, contains, "msgnum:" { + action( + type="omprog" + binary=`echo $srcdir/testsuites/omprog-transactions-bin.sh` + template="outfmt" + name="omprog_action" + queue.type="Direct" # the default; facilitates sync with the child process + queue.dequeueBatchSize="6" + confirmMessages="on" + useTransactions="on" + beginTransactionMark="BEGIN TRANSACTION" + commitTransactionMark="COMMIT TRANSACTION" + action.resumeRetryCount="10" + action.resumeInterval="1" + ) +} +' +startup . $srcdir/diag.sh wait-startup . $srcdir/diag.sh injectmsg 0 10 . $srcdir/diag.sh wait-queueempty diff --git a/tests/omruleset-queue.sh b/tests/omruleset-queue.sh index a3e9ba303..3a4fcfe9b 100755 --- a/tests/omruleset-queue.sh +++ b/tests/omruleset-queue.sh @@ -17,7 +17,26 @@ if [ `uname` = "SunOS" ] ; then fi . $srcdir/diag.sh init -startup omruleset-queue.conf +generate_conf +add_conf ' +$ModLoad ../plugins/omruleset/.libs/omruleset +$ModLoad ../plugins/imtcp/.libs/imtcp +$InputTCPServerRun 13514 + +$ruleset rsinclude +# create ruleset main queue with default parameters +$RulesetCreateMainQueue on +# make sure we do not terminate too early! +$MainMsgQueueTimeoutShutdown 10000 +$template outfmt,"%msg:F,58:2%\n" +$template dynfile,"rsyslog.out.log" # trick to use relative path names! +:msg, contains, "msgnum:" ?dynfile;outfmt + +$ruleset RSYSLOG_DefaultRuleset +$ActionOmrulesetRulesetName rsinclude +*.* :omruleset: +' +startup . $srcdir/diag.sh injectmsg 0 20000 echo doing shutdown shutdown_when_empty diff --git a/tests/omruleset.sh b/tests/omruleset.sh index 621ae4a21..d52a3bc40 100755 --- a/tests/omruleset.sh +++ b/tests/omruleset.sh @@ -13,7 +13,22 @@ echo =============================================================================== echo \[omruleset.sh\]: basic test for omruleset functionality . $srcdir/diag.sh init -startup omruleset.conf +generate_conf +add_conf ' +$ModLoad ../plugins/omruleset/.libs/omruleset +$ModLoad ../plugins/imtcp/.libs/imtcp +$InputTCPServerRun 13514 + +$ruleset rsinclude +$template outfmt,"%msg:F,58:2%\n" +$template dynfile,"rsyslog.out.log" # trick to use relative path names! +:msg, contains, "msgnum:" ?dynfile;outfmt + +$ruleset RSYSLOG_DefaultRuleset +$ActionOmrulesetRulesetName rsinclude +*.* :omruleset: +' +startup . $srcdir/diag.sh injectmsg 0 5000 echo doing shutdown shutdown_when_empty diff --git a/tests/pgsql-basic-vg.sh b/tests/pgsql-basic-vg.sh index 4f1ef2abf..6e4feeeb1 100755 --- a/tests/pgsql-basic-vg.sh +++ b/tests/pgsql-basic-vg.sh @@ -5,7 +5,12 @@ psql -h localhost -U postgres -f testsuites/pgsql-basic.sql -startup_vg pgsql-basic.conf +generate_conf +add_conf ' +$ModLoad ../plugins/ompgsql/.libs/ompgsql +:msg, contains, "msgnum:" :ompgsql:127.0.0.1,syslogtest,postgres,testbench +' +startup_vg . $srcdir/diag.sh injectmsg 0 5000 shutdown_when_empty wait_shutdown_vg diff --git a/tests/pgsql-basic.sh b/tests/pgsql-basic.sh index caf439dbe..ea6fe5224 100755 --- a/tests/pgsql-basic.sh +++ b/tests/pgsql-basic.sh @@ -5,7 +5,12 @@ psql -h localhost -U postgres -f testsuites/pgsql-basic.sql -startup pgsql-basic.conf +generate_conf +add_conf ' +$ModLoad ../plugins/ompgsql/.libs/ompgsql +:msg, contains, "msgnum:" :ompgsql:127.0.0.1,syslogtest,postgres,testbench +' +startup . $srcdir/diag.sh injectmsg 0 5000 shutdown_when_empty wait_shutdown diff --git a/tests/pgsql-template-vg.sh b/tests/pgsql-template-vg.sh index daf3c2927..dd68c3ad3 100755 --- a/tests/pgsql-template-vg.sh +++ b/tests/pgsql-template-vg.sh @@ -5,7 +5,15 @@ psql -h localhost -U postgres -f testsuites/pgsql-basic.sql -startup_vg pgsql-template.conf +generate_conf +add_conf ' +# putting the message in the SyslogTag field, so we know the template is actually used +$template mytemplate,"insert into SystemEvents (SysLogTag) values ('%msg%')",STDSQL + +$ModLoad ../plugins/ompgsql/.libs/ompgsql +:msg, contains, "msgnum:" :ompgsql:127.0.0.1,syslogtest,postgres,testbench;mytemplate +' +startup_vg . $srcdir/diag.sh injectmsg 0 5000 shutdown_when_empty wait_shutdown_vg diff --git a/tests/pgsql-template.sh b/tests/pgsql-template.sh index 85d9c9f65..5df88c3e5 100755 --- a/tests/pgsql-template.sh +++ b/tests/pgsql-template.sh @@ -5,7 +5,15 @@ psql -h localhost -U postgres -f testsuites/pgsql-basic.sql -startup pgsql-template.conf +generate_conf +add_conf ' +# putting the message in the SyslogTag field, so we know the template is actually used +$template mytemplate,"insert into SystemEvents (SysLogTag) values ('%msg%')",STDSQL + +$ModLoad ../plugins/ompgsql/.libs/ompgsql +:msg, contains, "msgnum:" :ompgsql:127.0.0.1,syslogtest,postgres,testbench;mytemplate +' +startup . $srcdir/diag.sh injectmsg 0 5000 shutdown_when_empty wait_shutdown diff --git a/tests/pipe_noreader.sh b/tests/pipe_noreader.sh index 8bb7ecaaa..764f0cff0 100755 --- a/tests/pipe_noreader.sh +++ b/tests/pipe_noreader.sh @@ -19,8 +19,17 @@ echo TEST: \[pipe_noreader.sh\]: test for pipe writing without reader #export RSYSLOG_DEBUG="debug nostdout noprintmutexaction" #export RSYSLOG_DEBUGLOG="log" . $srcdir/diag.sh init +generate_conf +add_conf ' +$ModLoad ../plugins/imtcp/.libs/imtcp +$MainMsgQueueTimeoutShutdown 10000 +$InputTCPServerRun 13514 + +$template outfmt,"%msg:F,58:2%\n" +:msg, contains, "msgnum:" |./rsyslog.pipe +' mkfifo ./rsyslog.pipe -startup pipe_noreader.conf +startup # we need to emit ~ 128K of data according to bug report . $srcdir/diag.sh tcpflood -m1000 -d500 shutdown_when_empty # shut down rsyslogd when done processing messages diff --git a/tests/pipeaction.sh b/tests/pipeaction.sh index 3c305b79e..146c27d27 100755 --- a/tests/pipeaction.sh +++ b/tests/pipeaction.sh @@ -16,6 +16,21 @@ fi # create the pipe and start a background process that copies data from # it to the "regular" work file . $srcdir/diag.sh init +generate_conf +add_conf ' +$MainMsgQueueTimeoutShutdown 10000 + +# set spool locations and switch queue to disk-only mode +$WorkDirectory test-spool +$MainMsgQueueFilename mainq +$MainMsgQueueType disk + +$template outfmt,"%msg:F,58:2%\n" +# with pipes, we do not need to use absolute path names, so +# we can simply refer to our working pipe via the usual relative +# path name +:msg, contains, "msgnum:" |rsyslog-testbench-fifo;outfmt +' rm -f rsyslog-testbench-fifo mkfifo rsyslog-testbench-fifo cp rsyslog-testbench-fifo rsyslog.out.log & @@ -23,7 +38,7 @@ CPPROCESS=$! echo background cp process id is $CPPROCESS # now do the usual run -startup pipeaction.conf +startup # 20000 messages should be enough #. $srcdir/diag.sh tcpflood -m20000 . $srcdir/diag.sh injectmsg 0 20000 diff --git a/tests/prop-all-json-concurrency.sh b/tests/prop-all-json-concurrency.sh index e7caca31a..4434215fa 100755 --- a/tests/prop-all-json-concurrency.sh +++ b/tests/prop-all-json-concurrency.sh @@ -5,7 +5,27 @@ echo =============================================================================== echo \[prop-all-json-concurrency.sh\]: testing concurrency of $!all-json variables . $srcdir/diag.sh init -startup prop-all-json-concurrency.conf +generate_conf +add_conf ' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +template(name="interim" type="string" string="%$!tree!here!nbr%") +template(name="outfmt" type="string" string="%$.interim%\n") +template(name="all-json" type="string" string="%$!%\n") + +if $msg contains "msgnum:" then { + set $!tree!here!nbr = field($msg, 58, 2); + action(type="omfile" file="rsyslog2.out.log" template="all-json" + queue.type="linkedList") + + set $.interim = $!all-json; + unset $!tree!here!nbr; + action(type="omfile" file="rsyslog.out.log" template="outfmt" + queue.type="fixedArray") +} +' +startup sleep 1 . $srcdir/diag.sh tcpflood -m500000 shutdown_when_empty # shut down rsyslogd when done processing messages diff --git a/tests/queue-persist-drvr.sh b/tests/queue-persist-drvr.sh index 54d1edb1f..596cbe367 100755 --- a/tests/queue-persist-drvr.sh +++ b/tests/queue-persist-drvr.sh @@ -8,13 +8,32 @@ # uncomment for debugging support: echo testing memory queue persisting to disk, mode $1 . $srcdir/diag.sh init +generate_conf +add_conf ' +$ModLoad ../plugins/imtcp/.libs/imtcp +$MainMsgQueueTimeoutShutdown 1 +$MainMsgQueueSaveOnShutdown on +$InputTCPServerRun 13514 +$ModLoad ../plugins/omtesting/.libs/omtesting + +# set spool locations and switch queue to disk-only mode +$WorkDirectory test-spool +$MainMsgQueueFilename mainq +$IncludeConfig work-queuemode.conf + +$template outfmt,"%msg:F,58:2%\n" +$template dynfile,"rsyslog.out.log" # trick to use relative path names! +:msg, contains, "msgnum:" ?dynfile;outfmt + +$IncludeConfig work-delay.conf +' # prepare config echo \$MainMsgQueueType $1 > work-queuemode.conf echo "*.* :omtesting:sleep 0 1000" > work-delay.conf # inject 5000 msgs, so that we do not hit the high watermark -startup queue-persist.conf +startup . $srcdir/diag.sh injectmsg 0 5000 . $srcdir/diag.sh shutdown-immediate wait_shutdown @@ -23,7 +42,7 @@ wait_shutdown # restart engine and have rest processed #remove delay echo "#" > work-delay.conf -startup queue-persist.conf +startup shutdown_when_empty # shut down rsyslogd when done processing messages ./msleep 1000 $srcdir/diag.sh wait-shutdown diff --git a/tests/random.sh b/tests/random.sh index 8df01dcc1..5130ae99b 100755 --- a/tests/random.sh +++ b/tests/random.sh @@ -6,7 +6,22 @@ echo =============================================================================== echo TEST: \[random.sh\]: testing random data . $srcdir/diag.sh init -startup random.conf +generate_conf +add_conf ' +# The random data will generate TCP framing error messages. We will +# not clutter the test output with them. So we disable error messages +# to stderr. +$ErrorMessagesToStderr off + +$ModLoad ../plugins/imtcp/.libs/imtcp +$MainMsgQueueTimeoutShutdown 10000 +$InputTCPServerRun 13514 + +$template outfmt,"%rawmsg%\n" +$template dynfile,"rsyslog.out.log" # trick to use relative path names! +*.* /dev/null +' +startup # generate random data ./randomgen -f rsyslog.random.data -s 100000 ls -l rsyslog.random.data diff --git a/tests/rawmsg-after-pri.sh b/tests/rawmsg-after-pri.sh index a393f2b09..730db1f16 100755 --- a/tests/rawmsg-after-pri.sh +++ b/tests/rawmsg-after-pri.sh @@ -1,7 +1,16 @@ #!/bin/bash # This file is part of the rsyslog project, released under ASL 2.0 . $srcdir/diag.sh init -startup rawmsg-after-pri.conf +generate_conf +add_conf ' +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +template(type="string" name="outfmt" string="%rawmsg-after-pri%\n") +if $syslogfacility-text == "local0" then + action(type="omfile" file="rsyslog.out.log" template="outfmt") +' +startup . $srcdir/diag.sh tcpflood -m1 -P 129 shutdown_when_empty # shut down rsyslogd when done processing messages wait_shutdown # and wait for it to terminate diff --git a/tests/rfc5424parser.sh b/tests/rfc5424parser.sh index 61ba6b1e5..0da495d9c 100755 --- a/tests/rfc5424parser.sh +++ b/tests/rfc5424parser.sh @@ -4,7 +4,18 @@ echo =============================================================================== echo \[rfc5424parser.sh\]: testing mmpstrucdata . $srcdir/diag.sh init -startup rfc5424parser.conf +generate_conf +add_conf ' +module(load="../plugins/imtcp/.libs/imtcp") + +template(name="outfmt" type="string" string="%msg:F,58:2%\n") + +input(type="imtcp" port="13514") + +if $msg contains "msgnum" then + action(type="omfile" template="outfmt" file="rsyslog.out.log") +' +startup sleep 1 . $srcdir/diag.sh tcpflood -m100 -y shutdown_when_empty # shut down rsyslogd when done processing messages diff --git a/tests/rs_optimizer_pri.sh b/tests/rs_optimizer_pri.sh index 1aae648e1..2c60bc2d6 100755 --- a/tests/rs_optimizer_pri.sh +++ b/tests/rs_optimizer_pri.sh @@ -8,7 +8,17 @@ echo =============================================================================== echo \[rs_optimizer_pri.sh\]: testing RainerScript PRI optimizer . $srcdir/diag.sh init -startup rs_optimizer_pri.conf +generate_conf +add_conf ' +template(name="outfmt" type="string" string="%msg:F,58:2%\n") + +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +if $syslogfacility-text == "local4" then + action(type="omfile" template="outfmt" file="rsyslog.out.log") +' +startup sleep 1 . $srcdir/diag.sh tcpflood -m100 # correct facility . $srcdir/diag.sh tcpflood -m100 -P175 # incorrect facility --> must be ignored diff --git a/tests/rscript_contains.sh b/tests/rscript_contains.sh index 88561abbb..8215dde95 100755 --- a/tests/rscript_contains.sh +++ b/tests/rscript_contains.sh @@ -4,7 +4,12 @@ echo =============================================================================== echo \[rscript_contains.sh\]: test for contains script-filter . $srcdir/diag.sh init -startup rscript_contains.conf +generate_conf +add_conf ' +$template outfmt,"%msg:F,58:2%\n" +if $msg contains 'msgnum' then ./rsyslog.out.log;outfmt +' +startup . $srcdir/diag.sh injectmsg 0 5000 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_eq.sh b/tests/rscript_eq.sh index e3660728f..7e206cb6d 100755 --- a/tests/rscript_eq.sh +++ b/tests/rscript_eq.sh @@ -4,7 +4,22 @@ echo =============================================================================== echo \[rscript_eq.sh\]: testing rainerscript EQ statement . $srcdir/diag.sh init -startup rscript_eq.conf +generate_conf +add_conf ' +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + if $!usr!msgnum == "00005000" or + $!usr!msgnum == "00005001" or + $!usr!msgnum == "00005002" then + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} +' +startup . $srcdir/diag.sh injectmsg 0 8000 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_eq_var.sh b/tests/rscript_eq_var.sh index 655292048..636d9e0f1 100755 --- a/tests/rscript_eq_var.sh +++ b/tests/rscript_eq_var.sh @@ -4,7 +4,65 @@ echo =============================================================================== echo \[rscript_eq.sh\]: testing rainerscript EQ statement comparing two variables . $srcdir/diag.sh init -startup rscript_eq_var.conf +generate_conf +add_conf ' +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +set $!var1 = "value"; +set $!var2 = "value"; +if $!var1 == $!var2 then { + set $!var2 = "bad"; + if $!var1 == $!var2 then { + # Failure + stop + } else { + unset $!var1; + unset $!var2; + } +} else { + # Failure + stop +} +set $.var1 = "value"; +set $.var2 = "value"; +if $.var1 == $.var2 then { + set $.var2 = "bad"; + if $.var1 == $.var2 then { + # Failure + stop + } else { + unset $.var1; + unset $.var2; + } +} else { + # Failure + stop +} +set $/var1 = "value"; +set $/var2 = "value"; +if $/var1 == $/var2 then { + set $/var2 = "bad"; + if $/var1 == $/var2 then { + # Failure + stop + } else { + unset $/var1; + unset $/var2; + } +} else { + # Failure + stop +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} +' +startup . $srcdir/diag.sh injectmsg 0 1 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_field-vg.sh b/tests/rscript_field-vg.sh index 2faefc806..c4c316be4 100755 --- a/tests/rscript_field-vg.sh +++ b/tests/rscript_field-vg.sh @@ -11,7 +11,19 @@ fi echo =============================================================================== echo \[rscript_field-vg.sh\]: testing rainerscript field\(\) function . $srcdir/diag.sh init -startup_vg rscript_field.conf +generate_conf +add_conf ' +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} +' +startup_vg . $srcdir/diag.sh injectmsg 0 5000 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_field.sh b/tests/rscript_field.sh index 5cd623087..5c14e3621 100755 --- a/tests/rscript_field.sh +++ b/tests/rscript_field.sh @@ -4,7 +4,19 @@ echo =============================================================================== echo \[rscript_field.sh\]: testing rainerscript field\(\) function . $srcdir/diag.sh init -startup rscript_field.conf +generate_conf +add_conf ' +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} +' +startup . $srcdir/diag.sh injectmsg 0 5000 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_ge.sh b/tests/rscript_ge.sh index e13a66094..e65cbb7c0 100755 --- a/tests/rscript_ge.sh +++ b/tests/rscript_ge.sh @@ -4,7 +4,21 @@ echo =============================================================================== echo \[rscript_ge.sh\]: testing rainerscript GE statement . $srcdir/diag.sh init -startup rscript_ge.conf +generate_conf +add_conf ' +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + if $!usr!msgnum >= "00005000" then + stop + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} +' +startup . $srcdir/diag.sh injectmsg 0 8000 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_ge_var.sh b/tests/rscript_ge_var.sh index 316dd1df8..073bf31b1 100755 --- a/tests/rscript_ge_var.sh +++ b/tests/rscript_ge_var.sh @@ -4,7 +4,68 @@ echo =============================================================================== echo \[rscript_ge.sh\]: testing rainerscript GE statement for two JSON variables . $srcdir/diag.sh init -startup rscript_ge_var.conf +generate_conf +add_conf ' +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +set $!var1 = "42"; +set $!var2 = "42"; +set $!var3 = "41"; +if $!var1 >= $!var2 and $!var1 >= $!var3 then { + if $!var3 >= $!var1 then { + # Failure + stop + } else { + unset $!var1; + unset $!var2; + unset $!var3; + } +} else { + # Failure + stop +} +set $.var1 = "42"; +set $.var2 = "42"; +set $.var3 = "41"; +if $.var1 >= $.var2 and $.var1 >= $.var3 then { + if $.var3 >= $.var1 then { + # Failure + stop + } else { + unset $.var1; + unset $.var2; + unset $.var3; + } +} else { + # Failure + stop +} +set $/var1 = "42"; +set $/var2 = "42"; +set $/var3 = "41"; +if $/var1 >= $/var2 and $/var1 >= $/var3 then { + if $/var3 >= $/var1 then { + # Failure + stop + } else { + unset $/var1; + unset $/var2; + unset $/var3; + } +} else { + # Failure + stop +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} +' +startup . $srcdir/diag.sh injectmsg 0 1 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_gt.sh b/tests/rscript_gt.sh index faa24d6d5..1235fcbd6 100755 --- a/tests/rscript_gt.sh +++ b/tests/rscript_gt.sh @@ -4,7 +4,20 @@ echo =============================================================================== echo \[rscript_gt.sh\]: testing rainerscript GT statement . $srcdir/diag.sh init -startup rscript_gt.conf +generate_conf +add_conf ' +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + if $!usr!msgnum > "00004999" then + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} +' +startup . $srcdir/diag.sh injectmsg 0 8000 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_gt_var.sh b/tests/rscript_gt_var.sh index d41cd52ef..e3dae405c 100755 --- a/tests/rscript_gt_var.sh +++ b/tests/rscript_gt_var.sh @@ -4,7 +4,62 @@ echo =============================================================================== echo \[rscript_gt.sh\]: testing rainerscript GT statement for two JSON variables . $srcdir/diag.sh init -startup rscript_gt_var.conf +generate_conf +add_conf ' +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +set $!var1 = "43"; +set $!var2 = "42"; +if $!var1 > $!var2 then { + if $!var2 > $!var1 then { + # Failure + stop + } else { + unset $!var1; + unset $!var2; + } +} else { + # Failure + stop +} +set $.var1 = "43"; +set $.var2 = "42"; +if $.var1 > $.var2 then { + if $.var2 > $.var1 then { + # Failure + stop + } else { + unset $.var1; + unset $.var2; + } +} else { + # Failure + stop +} +set $/var1 = "43"; +set $/var2 = "42"; +if $/var1 > $/var2 then { + if $/var2 > $/var1 then { + # Failure + stop + } else { + unset $/var1; + unset $/var2; + } +} else { + # Failure + stop +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} +' +startup . $srcdir/diag.sh injectmsg 0 1 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_hash32-vg.sh b/tests/rscript_hash32-vg.sh index 4f45eb8af..cb8617541 100755 --- a/tests/rscript_hash32-vg.sh +++ b/tests/rscript_hash32-vg.sh @@ -4,7 +4,20 @@ echo =============================================================================== echo \rscript_hash32.sh\]: test for hash32 and hash64mod script-function . $srcdir/diag.sh init -startup_vg rscript_hash32.conf +generate_conf +add_conf ' +template(name="outfmt" type="string" string="%$.hash_no_1% - %$.hash_no_2%\n") + +module(load="../plugins/imtcp/.libs/imtcp") +module(load="../contrib/fmhash/.libs/fmhash") +input(type="imtcp" port="13514") + +set $.hash_no_1 = hash32("0f9a1d07-a8c9-43a7-a6f7-198dca3d932e"); +set $.hash_no_2 = hash32mod("0f9a1d07-a8c9-43a7-a6f7-198dca3d932e", 100); + +action(type="omfile" file="./rsyslog.out.log" template="outfmt") +' +startup_vg . $srcdir/diag.sh tcpflood -m 20 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_hash32.sh b/tests/rscript_hash32.sh index dc62f5212..fcd398e6b 100755 --- a/tests/rscript_hash32.sh +++ b/tests/rscript_hash32.sh @@ -4,7 +4,20 @@ echo =============================================================================== echo \rscript_hash32.sh\]: test for hash32 and hash64mod script-function . $srcdir/diag.sh init -startup rscript_hash32.conf +generate_conf +add_conf ' +template(name="outfmt" type="string" string="%$.hash_no_1% - %$.hash_no_2%\n") + +module(load="../plugins/imtcp/.libs/imtcp") +module(load="../contrib/fmhash/.libs/fmhash") +input(type="imtcp" port="13514") + +set $.hash_no_1 = hash32("0f9a1d07-a8c9-43a7-a6f7-198dca3d932e"); +set $.hash_no_2 = hash32mod("0f9a1d07-a8c9-43a7-a6f7-198dca3d932e", 100); + +action(type="omfile" file="./rsyslog.out.log" template="outfmt") +' +startup . $srcdir/diag.sh tcpflood -m 20 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_hash64-vg.sh b/tests/rscript_hash64-vg.sh index 3e2e581f3..011c1204a 100755 --- a/tests/rscript_hash64-vg.sh +++ b/tests/rscript_hash64-vg.sh @@ -4,7 +4,20 @@ echo =============================================================================== echo \rscript_hash64.sh\]: test for hash64 and hash64mod script-function . $srcdir/diag.sh init -startup_vg rscript_hash64.conf +generate_conf +add_conf ' +template(name="outfmt" type="string" string="%$.hash_no_1% - %$.hash_no_2%\n") + +module(load="../plugins/imtcp/.libs/imtcp") +module(load="../contrib/fmhash/.libs/fmhash") +input(type="imtcp" port="13514") + +set $.hash_no_1 = hash64("0f9a1d07-a8c9-43a7-a6f7-198dca3d932e"); +set $.hash_no_2 = hash64mod("0f9a1d07-a8c9-43a7-a6f7-198dca3d932e", 100); + +action(type="omfile" file="./rsyslog.out.log" template="outfmt") +' +startup_vg . $srcdir/diag.sh tcpflood -m 20 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_hash64.sh b/tests/rscript_hash64.sh index 862ea4c02..45fa9591d 100755 --- a/tests/rscript_hash64.sh +++ b/tests/rscript_hash64.sh @@ -4,7 +4,20 @@ echo =============================================================================== echo \rscript_hash64.sh\]: test for hash64 and hash64mod script-function . $srcdir/diag.sh init -startup rscript_hash64.conf +generate_conf +add_conf ' +template(name="outfmt" type="string" string="%$.hash_no_1% - %$.hash_no_2%\n") + +module(load="../plugins/imtcp/.libs/imtcp") +module(load="../contrib/fmhash/.libs/fmhash") +input(type="imtcp" port="13514") + +set $.hash_no_1 = hash64("0f9a1d07-a8c9-43a7-a6f7-198dca3d932e"); +set $.hash_no_2 = hash64mod("0f9a1d07-a8c9-43a7-a6f7-198dca3d932e", 100); + +action(type="omfile" file="./rsyslog.out.log" template="outfmt") +' +startup . $srcdir/diag.sh tcpflood -m 20 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_le.sh b/tests/rscript_le.sh index 2aab38454..72bbc205c 100755 --- a/tests/rscript_le.sh +++ b/tests/rscript_le.sh @@ -4,7 +4,20 @@ echo =============================================================================== echo \[rscript_le.sh\]: testing rainerscript LE statement . $srcdir/diag.sh init -startup rscript_le.conf +generate_conf +add_conf ' +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + if $!usr!msgnum <= "00005000" then + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} +' +startup . $srcdir/diag.sh injectmsg 0 8000 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_le_var.sh b/tests/rscript_le_var.sh index 52eb2c6a7..fcd8c3556 100755 --- a/tests/rscript_le_var.sh +++ b/tests/rscript_le_var.sh @@ -4,7 +4,68 @@ echo =============================================================================== echo \[rscript_le.sh\]: testing rainerscript LE statement for two JSON variables . $srcdir/diag.sh init -startup rscript_le_var.conf +generate_conf +add_conf ' +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +set $!var1 = "42"; +set $!var2 = "42"; +set $!var3 = "43"; +if $!var1 <= $!var2 and $!var1 <= $!var3 then { + if $!var3 <= $!var1 then { + # Failure + stop + } else { + unset $!var1; + unset $!var2; + unset $!var3; + } +} else { + # Failure + stop +} +set $.var1 = "42"; +set $.var2 = "42"; +set $.var3 = "43"; +if $.var1 <= $.var2 and $.var1 <= $.var3 then { + if $.var3 <= $.var1 then { + # Failure + stop + } else { + unset $.var1; + unset $.var2; + unset $.var3; + } +} else { + # Failure + stop +} +set $/var1 = "42"; +set $/var2 = "42"; +set $/var3 = "43"; +if $/var1 <= $/var2 and $/var1 <= $/var3 then { + if $/var3 <= $/var1 then { + # Failure + stop + } else { + unset $/var1; + unset $/var2; + unset $/var3; + } +} else { + # Failure + stop +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} +' +startup . $srcdir/diag.sh injectmsg 0 1 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_lt.sh b/tests/rscript_lt.sh index 30544b73a..063a25cb1 100755 --- a/tests/rscript_lt.sh +++ b/tests/rscript_lt.sh @@ -4,7 +4,20 @@ echo =============================================================================== echo \[rscript_lt.sh\]: testing rainerscript LT statement . $srcdir/diag.sh init -startup rscript_lt.conf +generate_conf +add_conf ' +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + if $!usr!msgnum < "00005000" then + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} +' +startup . $srcdir/diag.sh injectmsg 0 8000 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_lt_var.sh b/tests/rscript_lt_var.sh index 6cacda070..5708fd8e3 100755 --- a/tests/rscript_lt_var.sh +++ b/tests/rscript_lt_var.sh @@ -4,7 +4,62 @@ echo =============================================================================== echo \[rscript_lt.sh\]: testing rainerscript LT statement for two JSON variables . $srcdir/diag.sh init -startup rscript_lt_var.conf +generate_conf +add_conf ' +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +set $!var1 = "41"; +set $!var2 = "42"; +if $!var1 < $!var2 then { + if $!var2 < $!var1 then { + # Failure + stop + } else { + unset $!var1; + unset $!var2; + } +} else { + # Failure + stop +} +set $.var1 = "41"; +set $.var2 = "42"; +if $.var1 < $.var2 then { + if $.var2 < $.var1 then { + # Failure + stop + } else { + unset $.var1; + unset $.var2; + } +} else { + # Failure + stop +} +set $/var1 = "41"; +set $/var2 = "42"; +if $/var1 < $/var2 then { + if $/var2 < $/var1 then { + # Failure + stop + } else { + unset $/var1; + unset $/var2; + } +} else { + # Failure + stop +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} +' +startup . $srcdir/diag.sh injectmsg 0 1 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_ne.sh b/tests/rscript_ne.sh index ca1bfadff..2b982eba9 100755 --- a/tests/rscript_ne.sh +++ b/tests/rscript_ne.sh @@ -4,7 +4,26 @@ echo =============================================================================== echo \[rscript_ne.sh\]: testing rainerscript NE statement . $srcdir/diag.sh init -startup rscript_ne.conf +generate_conf +add_conf ' +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + if $!usr!msgnum != "00005000" and + $!usr!msgnum != "00005001" and + $!usr!msgnum != "00005002" then + set $!usr!write = 0; + else + set $!usr!write = 1; + if $!usr!write == 1 then + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} +' +startup . $srcdir/diag.sh injectmsg 0 8000 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_ne_var.sh b/tests/rscript_ne_var.sh index ca2db7d15..02222456d 100755 --- a/tests/rscript_ne_var.sh +++ b/tests/rscript_ne_var.sh @@ -4,7 +4,68 @@ echo =============================================================================== echo \[rscript_ne.sh\]: testing rainerscript NE statement for two JSON variables . $srcdir/diag.sh init -startup rscript_ne_var.conf +generate_conf +add_conf ' +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +set $!var1 = "value1"; +set $!var2 = "value2"; +if $!var1 != $!var2 then { + set $!var1 = "value"; + set $!var2 = "value"; + if $!var1 != $!var2 then { + # Failure + stop + } else { + unset $!var1; + unset $!var2; + } +} else { + # Failure + stop +} +set $.var1 = "value1"; +set $.var2 = "value2"; +if $.var1 != $.var2 then { + set $.var1 = "value"; + set $.var2 = "value"; + if $.var1 != $.var2 then { + # Failure + stop + } else { + unset $.var1; + unset $.var2; + } +} else { + # Failure + stop +} +set $/var1 = "value1"; +set $/var2 = "value2"; +if $/var1 != $/var2 then { + set $/var1 = "value"; + set $/var2 = "value"; + if $/var1 != $/var2 then { + # Failure + stop + } else { + unset $/var1; + unset $/var2; + } +} else { + # Failure + stop +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} +' +startup . $srcdir/diag.sh injectmsg 0 1 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_optimizer1.sh b/tests/rscript_optimizer1.sh index 587ecb4d2..a73395b97 100755 --- a/tests/rscript_optimizer1.sh +++ b/tests/rscript_optimizer1.sh @@ -4,7 +4,20 @@ echo =============================================================================== echo \[rscript_optimizer1.sh\]: testing rainerscript optimizer . $srcdir/diag.sh init -startup rscript_optimizer1.conf +generate_conf +add_conf ' +template(name="outfmt" type="list") { + property(name="msg" field.delimiter="58" field.number="2") + constant(value="\n") +} + +/* tcpflood uses local4.=debug */ +if prifilt("syslog.*") then + stop # it actually doesn't matter what we do here +else + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +' +startup . $srcdir/diag.sh injectmsg 0 5000 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_prifilt.sh b/tests/rscript_prifilt.sh index 97885c9a0..45b33fc53 100755 --- a/tests/rscript_prifilt.sh +++ b/tests/rscript_prifilt.sh @@ -4,7 +4,18 @@ echo =============================================================================== echo \[rscript_prifilt.sh\]: testing rainerscript prifield\(\) function . $srcdir/diag.sh init -startup rscript_prifilt.conf +generate_conf +add_conf ' +template(name="outfmt" type="list") { + property(name="msg" field.delimiter="58" field.number="2") + constant(value="\n") +} + +/* tcpflood uses local4.=debug, we use a bit more generic filter */ +if prifilt("local4.*") then + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +' +startup . $srcdir/diag.sh injectmsg 0 5000 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_random.sh b/tests/rscript_random.sh index 98dd49c0c..3ecca1876 100755 --- a/tests/rscript_random.sh +++ b/tests/rscript_random.sh @@ -4,7 +4,18 @@ echo =============================================================================== echo \[rscript_random.sh\]: test for random-number-generator script-function . $srcdir/diag.sh init -startup rscript_random.conf +generate_conf +add_conf ' +template(name="outfmt" type="string" string="%$.random_no%\n") + +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +set $.random_no = random(10); + +action(type="omfile" file="./rsyslog.out.log" template="outfmt") +' +startup . $srcdir/diag.sh tcpflood -m 20 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_re_extract.sh b/tests/rscript_re_extract.sh index f1f39d2f5..55e167352 100755 --- a/tests/rscript_re_extract.sh +++ b/tests/rscript_re_extract.sh @@ -4,7 +4,18 @@ echo =============================================================================== echo \[rscript_re_extract.sh\]: test re_extract rscript-fn . $srcdir/diag.sh init -startup rscript_re_extract.conf +generate_conf +add_conf ' +template(name="outfmt" type="string" string="*Number is %$.number%*\n") + +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +set $.number = re_extract($msg, '.* ([0-9]+)$', 0, 1, 'none'); + +action(type="omfile" file="./rsyslog.out.log" template="outfmt") +' +startup . $srcdir/diag.sh tcpflood -m 1 -I $srcdir/testsuites/date_time_msg echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_re_match.sh b/tests/rscript_re_match.sh index 73bde7100..9c4b14497 100755 --- a/tests/rscript_re_match.sh +++ b/tests/rscript_re_match.sh @@ -4,7 +4,18 @@ echo =============================================================================== echo \[rscript_re_match.sh\]: test re_match rscript-fn . $srcdir/diag.sh init -startup rscript_re_match.conf +generate_conf +add_conf ' +template(name="outfmt" type="string" string="*Matched*\n") + +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +if (re_match($msg, '.* ([0-9]+)$')) then { + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} +' +startup . $srcdir/diag.sh tcpflood -m 1 -I $srcdir/testsuites/date_time_msg echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_replace.sh b/tests/rscript_replace.sh index 78cb4da80..732534fde 100755 --- a/tests/rscript_replace.sh +++ b/tests/rscript_replace.sh @@ -4,7 +4,22 @@ echo =============================================================================== echo \[rscript_replace.sh\]: test for replace script-function . $srcdir/diag.sh init -startup rscript_replace.conf +generate_conf +add_conf ' +template(name="outfmt" type="string" string="%$.replaced_msg%\n") + +module(load="../plugins/imptcp/.libs/imptcp") +input(type="imptcp" port="13514") + +template(name="date_time" type="list") { + property(name="msg" regex.Expression="Thu .+ 2014" regex.Type="ERE" regex.Match="0") +} + +set $.replaced_msg = replace("date time: " & exec_template("date_time"), "O" & "ct", replace("october", "o", "0")); + +action(type="omfile" file="./rsyslog.out.log" template="outfmt") +' +startup . $srcdir/diag.sh tcpflood -m 1 -I $srcdir/testsuites/date_time_msg echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_replace_complex.sh b/tests/rscript_replace_complex.sh index e783a2e24..5391d0282 100755 --- a/tests/rscript_replace_complex.sh +++ b/tests/rscript_replace_complex.sh @@ -4,7 +4,21 @@ echo =============================================================================== echo \[rscript_replace_complex.sh\]: a more complex test for replace script-function . $srcdir/diag.sh init -startup rscript_replace_complex.conf +generate_conf +add_conf ' +template(name="outfmt" type="string" string="%$.replaced_msg%\n") + +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +set $.replaced_msg = replace($msg, "syslog", "rsyslog"); +set $.replaced_msg = replace($.replaced_msg, "hello", "hello_world"); +set $.replaced_msg = replace($.replaced_msg, "foo_bar_baz", "FBB"); +set $.replaced_msg = replace($.replaced_msg, "as_longer_this_string_as_more_probability_to_catch_the_bug", "ss"); + +action(type="omfile" file="./rsyslog.out.log" template="outfmt") +' +startup . $srcdir/diag.sh tcpflood -m 1 -I $srcdir/testsuites/complex_replace_input echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_ruleset_call.sh b/tests/rscript_ruleset_call.sh index eb8ffe330..feefedf1a 100755 --- a/tests/rscript_ruleset_call.sh +++ b/tests/rscript_ruleset_call.sh @@ -4,7 +4,30 @@ echo =============================================================================== echo \[rscript_ruleset_call.sh\]: testing rainerscript ruleset\(\) and call statement . $srcdir/diag.sh init -startup rscript_ruleset_call.conf +generate_conf +add_conf ' +template(name="outfmt" type="list") { + property(name="msg" field.delimiter="58" field.number="2") + constant(value="\n") +} + + +# we deliberately include continue/stop to make sure we have more than +# one statement. This catches grammar erorrs +ruleset(name="rs2") { + continue + action(type="omfile" file="./rsyslog.out.log" template="outfmt") + stop +} + +# this time we make sure a single statement is properly supported +ruleset(name="rs1") { + call rs2 +} + +if $msg contains 'msgnum' then call rs1 +' +startup . $srcdir/diag.sh injectmsg 0 5000 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_set_modify.sh b/tests/rscript_set_modify.sh index 270505376..aa754606a 100755 --- a/tests/rscript_set_modify.sh +++ b/tests/rscript_set_modify.sh @@ -5,7 +5,20 @@ echo =============================================================================== echo \[rscript_set_modify.sh\]: testing set twice . $srcdir/diag.sh init -startup rscript_set_modify.conf +generate_conf +add_conf ' +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 1); + set $!usr!msgnum = field($msg, 58, 2); + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} +' +startup . $srcdir/diag.sh injectmsg 0 100 shutdown_when_empty wait_shutdown diff --git a/tests/rscript_stop.sh b/tests/rscript_stop.sh index d231c995c..7454047c4 100755 --- a/tests/rscript_stop.sh +++ b/tests/rscript_stop.sh @@ -4,7 +4,21 @@ echo =============================================================================== echo \[rscript_stop.sh\]: testing rainerscript STOP statement . $srcdir/diag.sh init -startup rscript_stop.conf +generate_conf +add_conf ' +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + if cnum($!usr!msgnum) >= 5000 then + stop + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} +' +startup . $srcdir/diag.sh injectmsg 0 8000 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_stop2.sh b/tests/rscript_stop2.sh index 5d77486ee..c1796d1e8 100755 --- a/tests/rscript_stop2.sh +++ b/tests/rscript_stop2.sh @@ -4,7 +4,26 @@ echo =============================================================================== echo \[rscript_stop2.sh\]: testing rainerscript STOP statement, alternate method . $srcdir/diag.sh init -startup rscript_stop2.conf +generate_conf +add_conf ' +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +if not ($msg contains 'msgnum') then + stop + +set $!usr!msgnum = field($msg, 58, 2); +if cnum($!usr!msgnum) >= 5000 then + stop +/* We could use yet another method, but we like to have the action statement + * without a filter in rsyslog.conf top level hierarchy - so this test, as + * a side-effect, also tests this ability. + */ +action(type="omfile" file="./rsyslog.out.log" template="outfmt") +' +startup . $srcdir/diag.sh injectmsg 0 8000 echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_unaffected_reset.sh b/tests/rscript_unaffected_reset.sh index e1b961bbc..dbf2aedd5 100755 --- a/tests/rscript_unaffected_reset.sh +++ b/tests/rscript_unaffected_reset.sh @@ -6,7 +6,20 @@ echo =============================================================================== echo \[rscript_unaffected_reset.sh\]: testing set/reset . $srcdir/diag.sh init -startup rscript_unaffected_reset.conf +generate_conf +add_conf ' +template(name="outfmt" type="list") { + property(name="$!usr!msgnum") + constant(value="\n") +} + +if $msg contains 'msgnum' then { + set $!usr!msgnum = field($msg, 58, 2); + set $!usr!msgnum_reset = "dummy"; + action(type="omfile" file="./rsyslog.out.log" template="outfmt") +} +' +startup . $srcdir/diag.sh injectmsg 0 100 shutdown_when_empty wait_shutdown diff --git a/tests/rscript_wrap2.sh b/tests/rscript_wrap2.sh index b0188da78..b4d074bfa 100755 --- a/tests/rscript_wrap2.sh +++ b/tests/rscript_wrap2.sh @@ -4,7 +4,18 @@ echo =============================================================================== echo \[rscript_wrap2.sh\]: a test for wrap\(2\) script-function . $srcdir/diag.sh init -startup rscript_wrap2.conf +generate_conf +add_conf ' +template(name="outfmt" type="string" string="%$.replaced_msg%\n") + +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +set $.replaced_msg = wrap("foo says" & $msg, "*" & "*"); + +action(type="omfile" file="./rsyslog.out.log" template="outfmt") +' +startup . $srcdir/diag.sh tcpflood -m 1 -I $srcdir/testsuites/date_time_msg echo doing shutdown shutdown_when_empty diff --git a/tests/rscript_wrap3.sh b/tests/rscript_wrap3.sh index fa73493e0..0f38d945e 100755 --- a/tests/rscript_wrap3.sh +++ b/tests/rscript_wrap3.sh @@ -4,7 +4,18 @@ echo =============================================================================== echo \[rscript_wrap3.sh\]: a test for wrap\(3\) script-function . $srcdir/diag.sh init -startup rscript_wrap3.conf +generate_conf +add_conf ' +template(name="outfmt" type="string" string="%$.replaced_msg%\n") + +module(load="../plugins/imtcp/.libs/imtcp") +input(type="imtcp" port="13514") + +set $.replaced_msg = wrap("foo says" & $msg, "bc" & "def" & "bc", "ES" & "C"); + +action(type="omfile" file="./rsyslog.out.log" template="outfmt") +' +startup . $srcdir/diag.sh tcpflood -m 1 -I $srcdir/testsuites/wrap3_input echo doing shutdown shutdown_when_empty diff --git a/tests/rsf_getenv.sh b/tests/rsf_getenv.sh index 5f9a39cc9..b5e7761b7 100755 --- a/tests/rsf_getenv.sh +++ b/tests/rsf_getenv.sh @@ -9,7 +9,22 @@ echo =========================================================================== echo \[rsf_getenv.sh\]: testing RainerScript getenv\(\) function export MSGNUM="msgnum:" . $srcdir/diag.sh init -startup rsf_getenv.conf +generate_conf +add_conf ' +$ModLoad ../plugins/imtcp/.libs/imtcp +$MainMsgQueueTimeoutShutdown 10000 +$InputTCPServerRun 13514 + +# set spool locations and switch queue to disk-only mode +$WorkDirectory test-spool +$MainMsgQueueFilename mainq +$MainMsgQueueType disk + +$template outfmt,"%msg:F,58:2%\n" +$template dynfile,"rsyslog.out.log" # trick to use relative path names! +if $msg contains getenv('MSGNUM') then ?dynfile;outfmt +' +startup . $srcdir/diag.sh tcpflood -m10000 shutdown_when_empty # shut down rsyslogd when done processing messages wait_shutdown diff --git a/tests/rulesetmultiqueue-v6.sh b/tests/rulesetmultiqueue-v6.sh index c4a373ece..5bd2d152a 100755 --- a/tests/rulesetmultiqueue-v6.sh +++ b/tests/rulesetmultiqueue-v6.sh @@ -16,8 +16,42 @@ if [ `uname` = "SunOS" ] ; then fi . $srcdir/diag.sh init +generate_conf +add_conf ' +$ModLoad ../plugins/imtcp/.libs/imtcp +$MainMsgQueueTimeoutShutdown 10000 + +# general definition +$template outfmt,"%msg:F,58:2%\n" + +# create the individual rulesets +$template dynfile1,"rsyslog.out1.log" # trick to use relative path names! +ruleset(name="file1" queue.type="linkedList") { + :msg, contains, "msgnum:" ?dynfile1;outfmt +} + +$template dynfile2,"rsyslog.out2.log" # trick to use relative path names! +ruleset(name="file2" queue.type="linkedList") { + :msg, contains, "msgnum:" ?dynfile2;outfmt +} + +$template dynfile3,"rsyslog.out3.log" # trick to use relative path names! +ruleset(name="file3" queue.type="linkedList") { + :msg, contains, "msgnum:" ?dynfile3;outfmt +} + +# start listeners and bind them to rulesets +$InputTCPServerBindRuleset file1 +$InputTCPServerRun 13514 + +$InputTCPServerBindRuleset file2 +$InputTCPServerRun 13515 + +$InputTCPServerBindRuleset file3 +$InputTCPServerRun 13516 +' rm -f rsyslog.out1.log rsyslog.out2.log rsyslog.out3.log -startup rulesetmultiqueue-v6.conf +startup . $srcdir/diag.sh wait-startup # now fill the three files (a bit sequentially, but they should # still get their share of concurrency - to increase the chance diff --git a/tests/rulesetmultiqueue.sh b/tests/rulesetmultiqueue.sh index 778258edb..68f7bd6b8 100755 --- a/tests/rulesetmultiqueue.sh +++ b/tests/rulesetmultiqueue.sh @@ -16,8 +16,42 @@ if [ `uname` = "SunOS" ] ; then fi . $srcdir/diag.sh init +generate_conf +add_conf ' +$ModLoad ../plugins/imtcp/.libs/imtcp +$MainMsgQueueTimeoutShutdown 10000 + +# general definition +$template outfmt,"%msg:F,58:2%\n" + +# create the individual rulesets +$ruleset file1 +$RulesetCreateMainQueue on +$template dynfile1,"rsyslog.out1.log" # trick to use relative path names! +:msg, contains, "msgnum:" ?dynfile1;outfmt + +$ruleset file2 +$RulesetCreateMainQueue on +$template dynfile2,"rsyslog.out2.log" # trick to use relative path names! +:msg, contains, "msgnum:" ?dynfile2;outfmt + +$ruleset file3 +$RulesetCreateMainQueue on +$template dynfile3,"rsyslog.out3.log" # trick to use relative path names! +:msg, contains, "msgnum:" ?dynfile3;outfmt + +# start listeners and bind them to rulesets +$InputTCPServerBindRuleset file1 +$InputTCPServerRun 13514 + +$InputTCPServerBindRuleset file2 +$InputTCPServerRun 13515 + +$InputTCPServerBindRuleset file3 +$InputTCPServerRun 13516 +' rm -f rsyslog.out1.log rsyslog.out2.log rsyslog.out3.log -startup rulesetmultiqueue.conf +startup . $srcdir/diag.sh wait-startup # now fill the three files (a bit sequentially, but they should # still get their share of concurrency - to increase the chance diff --git a/tests/sparse_array_lookup_table-vg.sh b/tests/sparse_array_lookup_table-vg.sh index a4a12779b..553726d63 100755 --- a/tests/sparse_array_lookup_table-vg.sh +++ b/tests/sparse_array_lookup_table-vg.sh @@ -11,8 +11,20 @@ fi echo =============================================================================== echo \[sparse_array_lookup_table.sh\]: test for sparse-array lookup-table and HUP based reloading of it . $srcdir/diag.sh init +generate_conf +add_conf ' +lookup_table(name="xlate" file="xlate_array.lkp_tbl") + +template(name="outfmt" type="string" string="%msg% %$.lkp%\n") + +set $.num = field($msg, 58, 2); + +set $.lkp = lookup("xlate", $.num); + +action(type="omfile" file="./rsyslog.out.log" template="outfmt") +' cp -f $srcdir/testsuites/xlate_sparse_array.lkp_tbl xlate_array.lkp_tbl -startup_vg array_lookup_table.conf +startup_vg . $srcdir/diag.sh injectmsg 0 1 . $srcdir/diag.sh wait-queueempty . $srcdir/diag.sh assert-content-missing "foo" diff --git a/tests/sparse_array_lookup_table.sh b/tests/sparse_array_lookup_table.sh index cba1e7638..7e6bb9424 100755 --- a/tests/sparse_array_lookup_table.sh +++ b/tests/sparse_array_lookup_table.sh @@ -11,8 +11,20 @@ fi echo =============================================================================== echo \[sparse_array_lookup_table.sh\]: test for sparse-array lookup-table and HUP based reloading of it . $srcdir/diag.sh init +generate_conf +add_conf ' +lookup_table(name="xlate" file="xlate_array.lkp_tbl") + +template(name="outfmt" type="string" string="%msg% %$.lkp%\n") + +set $.num = field($msg, 58, 2); + +set $.lkp = lookup("xlate", $.num); + +action(type="omfile" file="./rsyslog.out.log" template="outfmt") +' cp -f $srcdir/testsuites/xlate_sparse_array.lkp_tbl xlate_array.lkp_tbl -startup array_lookup_table.conf +startup . $srcdir/diag.sh injectmsg 0 1 . $srcdir/diag.sh wait-queueempty . $srcdir/diag.sh assert-content-missing "foo" diff --git a/tests/stats-cee-vg.sh b/tests/stats-cee-vg.sh index 9dddab382..32c813f8e 100755 --- a/tests/stats-cee-vg.sh +++ b/tests/stats-cee-vg.sh @@ -11,7 +11,19 @@ fi echo =============================================================================== echo \[stats-cee-vg.sh\]: test for verifying stats are reported correctly cee format with valgrind . $srcdir/diag.sh init -startup_vg stats-cee.conf +generate_conf +add_conf ' +ruleset(name="stats") { + action(type="omfile" file="./rsyslog.out.stats.log") +} + +module(load="../plugins/impstats/.libs/impstats" interval="1" severity="7" resetCounters="on" Ruleset="stats" bracketing="on" format="cee") + +if ($msg == "this condition will never match") then { + action(name="an_action_that_is_never_called" type="omfile" file="./rsyslog.out.log") +} +' +startup_vg . $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_1 . $srcdir/diag.sh wait-queueempty . $srcdir/diag.sh wait-for-stats-flush 'rsyslog.out.stats.log' diff --git a/tests/stats-cee.sh b/tests/stats-cee.sh index 152f16653..2d59fd3ca 100755 --- a/tests/stats-cee.sh +++ b/tests/stats-cee.sh @@ -4,7 +4,19 @@ echo =============================================================================== echo \[stats-cee.sh\]: test for verifying stats are reported correctly cee format . $srcdir/diag.sh init -startup stats-cee.conf +generate_conf +add_conf ' +ruleset(name="stats") { + action(type="omfile" file="./rsyslog.out.stats.log") +} + +module(load="../plugins/impstats/.libs/impstats" interval="1" severity="7" resetCounters="on" Ruleset="stats" bracketing="on" format="cee") + +if ($msg == "this condition will never match") then { + action(name="an_action_that_is_never_called" type="omfile" file="./rsyslog.out.log") +} +' +startup . $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_1 . $srcdir/diag.sh wait-queueempty . $srcdir/diag.sh wait-for-stats-flush 'rsyslog.out.stats.log' diff --git a/tests/stats-json-es.sh b/tests/stats-json-es.sh index db1e3e228..52b700c67 100755 --- a/tests/stats-json-es.sh +++ b/tests/stats-json-es.sh @@ -4,7 +4,19 @@ echo =============================================================================== echo \[stats-json-es.sh\]: test for verifying stats are reported correctly json-elasticsearch format . $srcdir/diag.sh init -startup stats-json-es.conf +generate_conf +add_conf ' +ruleset(name="stats") { + action(type="omfile" file="./rsyslog.out.stats.log") +} + +module(load="../plugins/impstats/.libs/impstats" interval="1" severity="7" resetCounters="on" Ruleset="stats" bracketing="on" format="json-elasticsearch") + +if ($msg == "this condition will never match") then { + action(name="an_action_that_is_never_called" type="omfile" file="./rsyslog.out.log") +} +' +startup . $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_1 . $srcdir/diag.sh wait-queueempty . $srcdir/diag.sh wait-for-stats-flush 'rsyslog.out.stats.log' diff --git a/tests/stats-json-vg.sh b/tests/stats-json-vg.sh index 7cf743cdd..134c78b50 100755 --- a/tests/stats-json-vg.sh +++ b/tests/stats-json-vg.sh @@ -11,7 +11,19 @@ fi echo =============================================================================== echo \[stats-json-vg.sh\]: test for verifying stats are reported correctly json format with valgrind . $srcdir/diag.sh init -startup_vg stats-json.conf +generate_conf +add_conf ' +ruleset(name="stats") { + action(type="omfile" file="./rsyslog.out.stats.log") +} + +module(load="../plugins/impstats/.libs/impstats" interval="1" severity="7" resetCounters="on" Ruleset="stats" bracketing="on" format="json") + +if ($msg == "this condition will never match") then { + action(name="an_action_that_is_never_called" type="omfile" file="./rsyslog.out.log") +} +' +startup_vg . $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_1 . $srcdir/diag.sh wait-queueempty . $srcdir/diag.sh wait-for-stats-flush 'rsyslog.out.stats.log' diff --git a/tests/stats-json.sh b/tests/stats-json.sh index 4a159cbd6..aef5c865b 100755 --- a/tests/stats-json.sh +++ b/tests/stats-json.sh @@ -4,7 +4,19 @@ echo =============================================================================== echo \[stats-json.sh\]: test for verifying stats are reported correctly json format . $srcdir/diag.sh init -startup stats-json.conf +generate_conf +add_conf ' +ruleset(name="stats") { + action(type="omfile" file="./rsyslog.out.stats.log") +} + +module(load="../plugins/impstats/.libs/impstats" interval="1" severity="7" resetCounters="on" Ruleset="stats" bracketing="on" format="json") + +if ($msg == "this condition will never match") then { + action(name="an_action_that_is_never_called" type="omfile" file="./rsyslog.out.log") +} +' +startup . $srcdir/diag.sh injectmsg-litteral $srcdir/testsuites/dynstats_input_1 . $srcdir/diag.sh wait-queueempty . $srcdir/diag.sh wait-for-stats-flush 'rsyslog.out.stats.log'