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/mmnormalize_tokenized.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 'tests/mmnormalize_tokenized.sh')
-rwxr-xr-x | tests/mmnormalize_tokenized.sh | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/mmnormalize_tokenized.sh b/tests/mmnormalize_tokenized.sh new file mode 100755 index 0000000..55b8db2 --- /dev/null +++ b/tests/mmnormalize_tokenized.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# added 2014-11-03 by singh.janmejay +# This file is part of the rsyslog project, released under ASL 2.0 +echo =============================================================================== +echo \[mmnormalize_tokenized.sh\]: test for mmnormalize tokenized field_type +. ${srcdir:=.}/diag.sh init +generate_conf +add_conf ' +template(name="ips" type="string" string="%$.ips%\n") + +template(name="paths" type="string" string="%$!fragments% %$!user%\n") +template(name="numbers" type="string" string="nos: %$!some_nos%\n") + +module(load="../plugins/mmnormalize/.libs/mmnormalize") +module(load="../plugins/imptcp/.libs/imptcp") +input(type="imptcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port") + +action(type="mmnormalize" rulebase=`echo $srcdir/testsuites/mmnormalize_tokenized.rulebase`) +if ( $!only_ips != "" ) then { + set $.ips = $!only_ips; + action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="ips") +} else if ( $!local_ips != "" ) then { + set $.ips = $!local_ips; + action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="ips") +} else if ( $!external_ips != "" ) then { + set $.ips = $!external_ips; + action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="ips") +} else if ( $!some_nos != "" ) then { + action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="numbers") +} else { + action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="paths") +} +' +startup +tcpflood -m 1 -I $srcdir/testsuites/tokenized_input +echo doing shutdown +shutdown_when_empty +echo wait on shutdown +wait_shutdown +cp $RSYSLOG_OUT_LOG /tmp/ +content_check '[ "10.20.30.40", "50.60.70.80", "90.100.110.120", "130.140.150.160" ]' +content_check '[ "192.168.1.2", "192.168.1.3", "192.168.1.4" ]' +content_check '[ "10.20.30.40", "50.60.70.80", "190.200.210.220" ]' +content_check '[ "\/bin", "\/usr\/local\/bin", "\/usr\/bin" ] foo' +content_check '[ [ [ "10" ] ], [ [ "20" ], [ "30", "40", "50" ], [ "60", "70", "80" ] ], [ [ "90" ], [ "100" ] ] ]' +exit_test |