mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-17 09:20:41 +01:00
headerless is indicated by whitespace followed by either '{' or '['.
This follows the trend to send JSON messages via syslog without any
header. We use default header values in this case.
This right now is a bit experimental; we may roll it back if
problems show up in practice.
closes https://github.com/rsyslog/rsyslog/issues/2030
33 lines
1.0 KiB
Bash
Executable File
33 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# add 2017-12-12 by Rainer Gerhards, released under ASL 2.0
|
|
. $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" ruleset="rs")
|
|
template(name="outfmt" type="string" string="%msg%---%rawmsg%\n")
|
|
|
|
ruleset(name="rs") {
|
|
action(type="omfile" template="outfmt" file="rsyslog.out.log")
|
|
}
|
|
'
|
|
. $srcdir/diag.sh startup
|
|
. $srcdir/diag.sh tcpflood -m1 -M "\"{ \\\"c1\\\":1 }\""
|
|
. $srcdir/diag.sh tcpflood -m1 -M "\" { \\\"c2\\\":2 }\""
|
|
. $srcdir/diag.sh tcpflood -m1 -M "\" [{ \\\"c3\\\":3 }]\""
|
|
. $srcdir/diag.sh shutdown-when-empty
|
|
. $srcdir/diag.sh wait-shutdown
|
|
EXPECTED='{ "c1":1 }---{ "c1":1 }
|
|
{ "c2":2 }--- { "c2":2 }
|
|
[{ "c3":3 }]--- [{ "c3":3 }]'
|
|
echo "$EXPECTED" | cmp - rsyslog.out.log
|
|
if [ ! $? -eq 0 ]; then
|
|
echo "invalid response generated, rsyslog.out.log is:"
|
|
cat rsyslog.out.log
|
|
printf "expected was\n"
|
|
echo "$EXPECTED"
|
|
. $srcdir/diag.sh error-exit 1
|
|
fi;
|
|
|
|
. $srcdir/diag.sh exit
|