2019-11-03 20:24:36 +05:30
|
|
|
#!/bin/sh
|
2021-11-22 15:52:04 +05:30
|
|
|
if [ x"${srcdir}" = x ]; then
|
|
|
|
srcdir=.
|
|
|
|
fi
|
|
|
|
. ${srcdir}/start.sh
|
2019-11-03 20:24:36 +05:30
|
|
|
|
|
|
|
export MSG="no-openlog-apitest"
|
2019-11-04 00:21:39 +05:30
|
|
|
|
|
|
|
echo "= Phase 1 - simple syslog(), no openlog() ==============="
|
2019-11-03 20:24:36 +05:30
|
|
|
./api
|
2019-11-13 13:01:36 +05:30
|
|
|
grep "api: ${MSG}" ${LOG}
|
2019-11-04 00:21:39 +05:30
|
|
|
|
|
|
|
echo "= Phase 2 - syslog() with openlog() & custom facility ==="
|
2019-11-12 17:56:17 +05:30
|
|
|
cat <<EOF >${CONFD}/console.conf
|
2019-11-04 00:21:39 +05:30
|
|
|
console.* -${LOGCONS}
|
|
|
|
EOF
|
|
|
|
kill -HUP `cat ${PID}`
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
./api -i foo
|
2019-11-13 13:01:36 +05:30
|
|
|
grep "foo: ${MSG}" ${LOGCONS}
|
2019-11-04 00:21:39 +05:30
|
|
|
|
|
|
|
echo "= Phase 3 - Verify setlogmask() filters out LOG_INFO ===="
|
|
|
|
./api -i xyzzy -l
|
2019-11-13 13:01:36 +05:30
|
|
|
grep "xyzzy: ${MSG}" ${LOGCONS} || true
|
2019-11-04 00:21:39 +05:30
|
|
|
|
|
|
|
echo "= Phase 4 - Verify RFC5424 API with syslogp() ==========="
|
|
|
|
cat <<EOF >${CONFD}/v1.conf
|
|
|
|
ftp.* -${LOGV1} ;RFC5424
|
|
|
|
EOF
|
|
|
|
kill -HUP `cat ${PID}`
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
./api -i troglobit -p
|
2019-11-06 21:08:30 +05:30
|
|
|
sleep 2
|
|
|
|
ps fax |grep -A2 syslogd
|
2019-11-06 20:56:44 +05:30
|
|
|
grep "troglobit - MSGID - ${MSG}" ${LOGV1} || (echo "== ${LOGV1}"; tail -10 ${LOGV1}; echo "== ${LOG}"; tail -10 ${LOG}; cat ${CONFD}/v1.conf; false)
|
2019-11-04 00:21:39 +05:30
|
|
|
|
2019-11-08 03:49:03 +05:30
|
|
|
echo "= Phase 4 - Verify RFC5424 API with logger(1) ==========="
|
|
|
|
../src/logger -p ftp.notice -u ${SOCK} -m "MSDSD" -d '[exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"]' "waldo"
|
|
|
|
sleep 2
|
|
|
|
grep "exampleSDID@32473" ${LOGV1} || (echo "== ${LOGV1}"; tail -10 ${LOGV1}; false)
|
|
|
|
|
2021-11-22 09:29:23 +05:30
|
|
|
. ./stop.sh
|