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
|
2021-11-22 19:46:05 +05:30
|
|
|
. ${srcdir}/lib.sh
|
|
|
|
setup
|
2019-11-03 20:24:36 +05:30
|
|
|
|
|
|
|
export MSG="no-openlog-apitest"
|
2019-11-04 00:21:39 +05:30
|
|
|
|
2022-03-06 05:32:03 +05:30
|
|
|
print "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
|
|
|
|
2022-03-06 05:32:03 +05:30
|
|
|
print "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
|
2022-03-06 05:26:03 +05:30
|
|
|
reload
|
2019-11-04 00:21:39 +05:30
|
|
|
|
|
|
|
./api -i foo
|
2019-11-13 13:01:36 +05:30
|
|
|
grep "foo: ${MSG}" ${LOGCONS}
|
2019-11-04 00:21:39 +05:30
|
|
|
|
2022-03-06 05:32:03 +05:30
|
|
|
print "Phase 3 - Verify setlogmask() filters out LOG_INFO"
|
2019-11-04 00:21:39 +05:30
|
|
|
./api -i xyzzy -l
|
2022-03-06 05:32:03 +05:30
|
|
|
grep "xyzzy: ${MSG}" "${LOGCONS}" && FAIL "Filtering w/ setlogmask() broken"
|
|
|
|
echo "Filtering w/ setlogmask() Works fine"
|
2019-11-04 00:21:39 +05:30
|
|
|
|
2022-03-06 05:32:03 +05:30
|
|
|
print "Phase 4 - Verify RFC5424 API with syslogp()"
|
2019-11-04 00:21:39 +05:30
|
|
|
cat <<EOF >${CONFD}/v1.conf
|
|
|
|
ftp.* -${LOGV1} ;RFC5424
|
|
|
|
EOF
|
2022-03-06 05:26:03 +05:30
|
|
|
reload
|
2019-11-04 00:21:39 +05:30
|
|
|
|
|
|
|
./api -i troglobit -p
|
2019-11-06 21:08:30 +05:30
|
|
|
sleep 2
|
|
|
|
ps fax |grep -A2 syslogd
|
2021-11-22 19:46:05 +05:30
|
|
|
grep "troglobit - MSGID - ${MSG}" ${LOGV1} || (echo "== ${LOGV1}"; tail -10 ${LOGV1}; echo "== ${LOG}"; tail -10 ${LOG}; cat ${CONFD}/v1.conf; FAIL "Cannot find troglobit")
|
2019-11-04 00:21:39 +05:30
|
|
|
|
2022-03-06 05:32:03 +05:30
|
|
|
print "Phase 4 - Verify RFC5424 API with logger(1)"
|
2019-11-08 03:49:03 +05:30
|
|
|
../src/logger -p ftp.notice -u ${SOCK} -m "MSDSD" -d '[exampleSDID@32473 iut="3" eventSource="Application" eventID="1011"]' "waldo"
|
|
|
|
sleep 2
|
2021-11-22 19:46:05 +05:30
|
|
|
grep "exampleSDID@32473" ${LOGV1} || (echo "== ${LOGV1}"; tail -10 ${LOGV1}; FAIL "Cannot find exampleSDID@32473")
|
2022-03-06 05:32:03 +05:30
|
|
|
|
|
|
|
OK
|