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/pmnormalize-rule.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/pmnormalize-rule.sh | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/pmnormalize-rule.sh b/tests/pmnormalize-rule.sh new file mode 100755 index 0000000..f7cdbf3 --- /dev/null +++ b/tests/pmnormalize-rule.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# add 2017-06-12 by Pascal Withopf, released under ASL 2.0 +. ${srcdir:=.}/diag.sh init +generate_conf +add_conf ' +module(load="../plugins/imtcp/.libs/imtcp") +module(load="../plugins/pmnormalize/.libs/pmnormalize") + +input(type="imtcp" port="0" listenPortFileName="'$RSYSLOG_DYNNAME'.tcpflood_port" ruleset="ruleset") +parser(name="custom.pmnormalize" type="pmnormalize" rule=["rule=:<%pri:number%> %fromhost-ip:ipv4% %hostname:word% %syslogtag:char-to:\\x3a%: %msg:rest%", "rule=:<%pri:number%> %hostname:word% %fromhost-ip:ipv4% %syslogtag:char-to:\\x3a%: %msg:rest%"]) + +template(name="test" type="string" string="host: %hostname%, ip: %fromhost-ip%, tag: %syslogtag%, pri: %pri%, syslogfacility: %syslogfacility%, syslogseverity: %syslogseverity% msg: %msg%\n") + +ruleset(name="ruleset" parser="custom.pmnormalize") { + action(type="omfile" file=`echo $RSYSLOG_OUT_LOG` template="test") +} +' +startup +tcpflood -m1 -M "\"<189> 127.0.0.1 ubuntu tag1: this is a test message\"" +tcpflood -m1 -M "\"<112> 255.255.255.255 debian tag2: this is a test message\"" +tcpflood -m1 -M "\"<177> centos 192.168.0.9 tag3: this is a test message\"" +shutdown_when_empty +wait_shutdown +export EXPECTED='host: ubuntu, ip: 127.0.0.1, tag: tag1, pri: 189, syslogfacility: 23, syslogseverity: 5 msg: this is a test message +host: debian, ip: 255.255.255.255, tag: tag2, pri: 112, syslogfacility: 14, syslogseverity: 0 msg: this is a test message +host: centos, ip: 192.168.0.9, tag: tag3, pri: 177, syslogfacility: 22, syslogseverity: 1 msg: this is a test message' +cmp_exact + +exit_test |