Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2146 from rgerhards/i-1977
rainerscript: new function "http_request"
- Loading branch information
Showing
7 changed files
with
231 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
# add 2017-12-01 by Rainer Gerhards, released under ASL 2.0 | ||
|
||
uname | ||
#if [ `uname` = "FreeBSD" ] ; then | ||
# echo "This test currently does not work on FreeBSD." | ||
# exit 77 | ||
#fi | ||
|
||
. $srcdir/diag.sh init | ||
. $srcdir/diag.sh generate-conf | ||
. $srcdir/diag.sh add-conf ' | ||
module(load="../plugins/imtcp/.libs/imtcp") | ||
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
# add 2017-12-01 by Rainer Gerhards, released under ASL 2.0 | ||
|
||
uname | ||
#if [ `uname` = "FreeBSD" ] ; then | ||
# echo "This test currently does not work on FreeBSD." | ||
# exit 77 | ||
#fi | ||
|
||
. $srcdir/diag.sh init | ||
. $srcdir/diag.sh generate-conf | ||
. $srcdir/diag.sh add-conf ' | ||
module(load="../plugins/imtcp/.libs/imtcp") | ||
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 | ||
. $srcdir/diag.sh tcpflood -m10 | ||
. $srcdir/diag.sh shutdown-when-empty | ||
. $srcdir/diag.sh wait-shutdown | ||
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 | ||
|