mirror of
https://github.com/rsyslog/rsyslog.git
synced 2025-12-17 01:00:40 +01:00
bugfix: RainerScript != did not work correctly with JSON variables
This commit is contained in:
parent
efc2822082
commit
260f4b6b3d
@ -1697,6 +1697,21 @@ cnfexprEval(const struct cnfexpr *const expr, struct var *ret, void* usrptr)
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(l.datatype == 'J') {
|
||||
estr_l = var2String(&l, &bMustFree);
|
||||
if(r.datatype == 'S') {
|
||||
ret->d.n = es_strcmp(estr_l, r.d.estr); /*CMP*/
|
||||
} else {
|
||||
n_l = var2Number(&l, &convok_l);
|
||||
if(convok_l) {
|
||||
ret->d.n = (n_l != r.d.n); /*CMP*/
|
||||
} else {
|
||||
estr_r = var2String(&r, &bMustFree2);
|
||||
ret->d.n = es_strcmp(estr_l, estr_r); /*CMP*/
|
||||
if(bMustFree2) es_deleteStr(estr_r);
|
||||
}
|
||||
}
|
||||
if(bMustFree) es_deleteStr(estr_l);
|
||||
} else {
|
||||
if(r.datatype == 'S') {
|
||||
n_r = var2Number(&r, &convok_r);
|
||||
|
||||
@ -298,6 +298,8 @@ EXTRA_DIST= 1.rstest 2.rstest 3.rstest err1.rstest \
|
||||
testsuites/rscript_lt.conf \
|
||||
rscript_gt.sh \
|
||||
testsuites/rscript_gt.conf \
|
||||
rscript_ne.sh \
|
||||
testsuites/rscript_ne.conf \
|
||||
stop-localvar.sh \
|
||||
testsuites/stop-localvar.conf \
|
||||
rscript_prifilt.sh \
|
||||
|
||||
13
tests/rscript_ne.sh
Executable file
13
tests/rscript_ne.sh
Executable file
@ -0,0 +1,13 @@
|
||||
# added 2014-01-17 by rgerhards
|
||||
# This file is part of the rsyslog project, released under ASL 2.0
|
||||
echo ===============================================================================
|
||||
echo \[rscript_ne.sh\]: testing rainerscript NE statement
|
||||
source $srcdir/diag.sh init
|
||||
source $srcdir/diag.sh startup rscript_ne.conf
|
||||
source $srcdir/diag.sh injectmsg 0 8000
|
||||
echo doing shutdown
|
||||
source $srcdir/diag.sh shutdown-when-empty
|
||||
echo wait on shutdown
|
||||
source $srcdir/diag.sh wait-shutdown
|
||||
source $srcdir/diag.sh seq-check 5000 5002
|
||||
source $srcdir/diag.sh exit
|
||||
18
tests/testsuites/rscript_ne.conf
Normal file
18
tests/testsuites/rscript_ne.conf
Normal file
@ -0,0 +1,18 @@
|
||||
$IncludeConfig diag-common.conf
|
||||
|
||||
template(name="outfmt" type="list") {
|
||||
property(name="$!usr!msgnum")
|
||||
constant(value="\n")
|
||||
}
|
||||
|
||||
if $msg contains 'msgnum' then {
|
||||
set $!usr!msgnum = field($msg, 58, 2);
|
||||
if $!usr!msgnum != "00005000" and
|
||||
$!usr!msgnum != "00005001" and
|
||||
$!usr!msgnum != "00005002" then
|
||||
set $!usr!write = 0;
|
||||
else
|
||||
set $!usr!write = 1;
|
||||
if $!usr!write == 1 then
|
||||
action(type="omfile" file="./rsyslog.out.log" template="outfmt")
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user