mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-16 12:10:46 +01:00
function modules add functions to rainerscript dynamically, change http_request into such a module (enabled by default). This module can be used as a sample for future function modules.
43 lines
1.4 KiB
Bash
Executable File
43 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
# add 2017-12-01 by Rainer Gerhards, released under ASL 2.0
|
|
. $srcdir/diag.sh init
|
|
. $srcdir/diag.sh check-url-access http://www.rsyslog.com/testbench/echo-get.php
|
|
. $srcdir/diag.sh generate-conf
|
|
. $srcdir/diag.sh add-conf '
|
|
module(load="../plugins/imtcp/.libs/imtcp")
|
|
module(load="../plugins/fmhttp/.libs/fmhttp")
|
|
input(type="imtcp" port="13514")
|
|
|
|
# for debugging the test itself:
|
|
#template(name="outfmt" type="string" string="%$!%: :%$.%: %rawmsg%\n")
|
|
template(name="outfmt" type="string" string="%$!%\n")
|
|
|
|
if $msg contains "msgnum:" then {
|
|
set $.url = "http://www.rsyslog.com/testbench/echo-get.php?content=" & ltrim($msg);
|
|
set $!reply = http_request($.url);
|
|
action(type="omfile" file="rsyslog.out.log" template="outfmt")
|
|
}
|
|
'
|
|
. $srcdir/diag.sh startup-vg
|
|
. $srcdir/diag.sh tcpflood -m10
|
|
. $srcdir/diag.sh shutdown-when-empty
|
|
. $srcdir/diag.sh wait-shutdown-vg
|
|
. $srcdir/diag.sh check-exit-vg
|
|
echo '{ "reply": "msgnum:00000000:" }
|
|
{ "reply": "msgnum:00000001:" }
|
|
{ "reply": "msgnum:00000002:" }
|
|
{ "reply": "msgnum:00000003:" }
|
|
{ "reply": "msgnum:00000004:" }
|
|
{ "reply": "msgnum:00000005:" }
|
|
{ "reply": "msgnum:00000006:" }
|
|
{ "reply": "msgnum:00000007:" }
|
|
{ "reply": "msgnum:00000008:" }
|
|
{ "reply": "msgnum:00000009:" }' | cmp - rsyslog.out.log
|
|
if [ ! $? -eq 0 ]; then
|
|
echo "invalid function output detected, rsyslog.out.log is:"
|
|
cat rsyslog.out.log
|
|
. $srcdir/diag.sh error-exit 1
|
|
fi;
|
|
. $srcdir/diag.sh exit
|
|
|