Merge pull request #1381 from GrayTShirt/mmdblookup-test

validate mmdblookup tests
This commit is contained in:
Rainer Gerhards 2017-01-26 13:33:29 +01:00 committed by GitHub
commit 29b6440958
4 changed files with 25 additions and 14 deletions

View File

@ -478,10 +478,10 @@ TESTS += \
json_var_case.sh
endif
#if ENABLE_MMDBLOOKUP
#TESTS += \
# mmdb.sh
#endif
if ENABLE_MMDBLOOKUP
TESTS += \
mmdb.sh
endif
if ENABLE_GNUTLS
TESTS += \
@ -858,6 +858,7 @@ EXTRA_DIST= \
mmjsonparse_cim.sh \
testsuites/mmjsonparse_cim.conf \
mmdb.sh \
mmdb.rb \
test.mmdb \
testsuites/mmdb.conf \
incltest.sh \

3
tests/mmdb.rb Normal file
View File

@ -0,0 +1,3 @@
version=2
rule=: %ip:word% %remaining:word%

View File

@ -3,12 +3,15 @@
# This file is part of the rsyslog project, released under ASL 2.0
echo ===============================================================================
echo \[mmdb.sh\]: test for mmdb
# uncomment for debugging support:
#export RSYSLOG_DEBUG="debug nostdout"
#export RSYSLOG_DEBUGLOG="log"
. $srcdir/diag.sh init
. $srcdir/diag.sh startup mmdb.conf
. $srcdir/diag.sh tcpflood -m 1 -j '202.106.0.20'
. $srcdir/diag.sh tcpflood -m 1 -j "202.106.0.20\ "
echo doing shutdown
. $srcdir/diag.sh shutdown-when-empty
echo wait on shutdown
. $srcdir/diag.sh wait-shutdown
. $srcdir/diag.sh content-check '"city" : "Beijing"'
. $srcdir/diag.sh content-check '{ "city": "Beijing" }'
. $srcdir/diag.sh exit

View File

@ -2,8 +2,12 @@ $IncludeConfig diag-common.conf
template(name="outfmt" type="string" string="%$!iplocation%\n")
module(load="../contrib/mmdblookup/.libs/mmdblookup")
module(load="../plugins/mmnormalize/.libs/mmnormalize")
module(load="../plugins/imptcp/.libs/imptcp")
input(type="imptcp" port="13514")
input(type="imptcp" port="13514" ruleset="testing")
action(type="mmdblookup" mmdbfile="./test.mmdb" key="msg" fields="city" )
ruleset(name="testing") {
action(type="mmnormalize" rulebase="./mmdb.rb")
action(type="mmdblookup" mmdbfile="./test.mmdb" key="$!ip" fields="city" )
action(type="omfile" file="./rsyslog.out.log" template="outfmt")
}