rsyslog/tests/rscript_previous_action_suspended.sh
Rainer Gerhards ce06bba15c RainerScript: implement previous_action_suspended() function
This function returns a boolean indicating if the previous action is
suspended (0 - no, 1 - yes). This is useful if arbitrary processing
(other than calling actions) should be made depending on that state.
A prime example for this is probably calling a ruleset.

closes https://github.com/rsyslog/rsyslog/issues/1939
2017-12-09 17:48:28 +01:00

28 lines
745 B
Bash
Executable File

#!/bin/bash
# Added 2017-12-09 by Rainer Gerhards, released under ASL 2.0
. $srcdir/diag.sh init
. $srcdir/diag.sh generate-conf
. $srcdir/diag.sh add-conf '
module(load="../plugins/imtcp/.libs/imtcp")
module(load="../plugins/omtesting/.libs/omtesting")
input(type="imtcp" port="13514")
template(name="outfmt" type="string" string="%msg:F,58:2%\n")
ruleset(name="output_writer") {
action(type="omfile" file="rsyslog.out.log" template="outfmt")
}
:msg, contains, "msgnum:" {
:omtesting:fail 2 0
if previous_action_suspended() then
call output_writer
}
'
. $srcdir/diag.sh startup
. $srcdir/diag.sh injectmsg 0 10
. $srcdir/diag.sh shutdown-when-empty
. $srcdir/diag.sh wait-shutdown
. $srcdir/diag.sh seq-check 1 9
. $srcdir/diag.sh exit