diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 16:28:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 16:28:20 +0000 |
commit | dcc721a95bef6f0d8e6d8775b8efe33e5aecd562 (patch) | |
tree | 66a2774cd0ee294d019efd71d2544c70f42b2842 /tests/dynstats_ctr_reset.sh | |
parent | Initial commit. (diff) | |
download | rsyslog-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 '')
-rwxr-xr-x | tests/dynstats_ctr_reset.sh | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/dynstats_ctr_reset.sh b/tests/dynstats_ctr_reset.sh new file mode 100755 index 0000000..17e9519 --- /dev/null +++ b/tests/dynstats_ctr_reset.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# added 2015-11-16 by singh.janmejay +# This file is part of the rsyslog project, released under ASL 2.0 +echo \[dynstats_ctr_reset.sh\]: test to ensure correctness of stats-ctr reset +. ${srcdir:=.}/diag.sh init +generate_conf +add_conf ' +ruleset(name="stats") { + action(type="omfile" file="'${RSYSLOG_DYNNAME}'.out.stats.log") +} + +module(load="../plugins/impstats/.libs/impstats" interval="1" severity="7" resetCounters="on" Ruleset="stats" bracketing="on") + +template(name="outfmt" type="string" string="%msg%\n") + +dyn_stats(name="msg_stats_resettable_on" resettable="on") +dyn_stats(name="msg_stats_resettable_off" resettable="off") +dyn_stats(name="msg_stats_resettable_default") + +set $.msg_prefix = field($msg, 32, 1); + +set $.x = dyn_inc("msg_stats_resettable_on", $.msg_prefix); +set $.y = dyn_inc("msg_stats_resettable_off", $.msg_prefix); +set $.z = dyn_inc("msg_stats_resettable_default", $.msg_prefix); + +action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="outfmt") +' +startup +injectmsg_file $srcdir/testsuites/dynstats_input_1 +injectmsg_file $srcdir/testsuites/dynstats_input_2 +wait_queueempty +sleep 1 +injectmsg_file $srcdir/testsuites/dynstats_input_3 +wait_queueempty +sleep 1 +echo doing shutdown +shutdown_when_empty +echo wait on shutdown +wait_shutdown +content_check "foo 006" +custom_content_check 'bar=1' "${RSYSLOG_DYNNAME}.out.stats.log" +first_column_sum_check 's/.*foo=\([0-9]*\)/\1/g' 'msg_stats_resettable_on.*foo=' "${RSYSLOG_DYNNAME}.out.stats.log" 3 +first_column_sum_check 's/.*bar=\([0-9]*\)/\1/g' 'msg_stats_resettable_on.*bar=' "${RSYSLOG_DYNNAME}.out.stats.log" 1 +first_column_sum_check 's/.*baz=\([0-9]*\)/\1/g' 'msg_stats_resettable_on.*baz=' "${RSYSLOG_DYNNAME}.out.stats.log" 2 +. $srcdir/diag.sh assert-first-column-sum-greater-than 's/.*foo=\([0-9]*\)/\1/g' 'msg_stats_resettable_off.*foo=' "${RSYSLOG_DYNNAME}.out.stats.log" 3 +. $srcdir/diag.sh assert-first-column-sum-greater-than 's/.*bar=\([0-9]*\)/\1/g' 'msg_stats_resettable_off.*bar=' "${RSYSLOG_DYNNAME}.out.stats.log" 1 +. $srcdir/diag.sh assert-first-column-sum-greater-than 's/.*baz=\([0-9]*\)/\1/g' 'msg_stats_resettable_off.*baz=' "${RSYSLOG_DYNNAME}.out.stats.log" 2 +first_column_sum_check 's/.*foo=\([0-9]*\)/\1/g' 'msg_stats_resettable_default.*foo=' "${RSYSLOG_DYNNAME}.out.stats.log" 3 +first_column_sum_check 's/.*bar=\([0-9]*\)/\1/g' 'msg_stats_resettable_default.*bar=' "${RSYSLOG_DYNNAME}.out.stats.log" 1 +first_column_sum_check 's/.*baz=\([0-9]*\)/\1/g' 'msg_stats_resettable_default.*baz=' "${RSYSLOG_DYNNAME}.out.stats.log" 2 +exit_test |