test: Add FWD test, two syslog daemons, a custom port and RFC5424
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
		@@ -13,6 +13,7 @@ TESTS            = start.sh
 | 
			
		||||
TESTS           += local.sh
 | 
			
		||||
TESTS           += remote.sh
 | 
			
		||||
TESTS           += api.sh
 | 
			
		||||
TESTS           += fwd.sh
 | 
			
		||||
TESTS           += stop.sh
 | 
			
		||||
 | 
			
		||||
programs: $(check_PROGRAMS)
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										30
									
								
								test/fwd.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										30
									
								
								test/fwd.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
# Test FWD between two syslogd, second binds 127.0.0.2:4444
 | 
			
		||||
set -ex
 | 
			
		||||
if [ x"${srcdir}" = x ]; then
 | 
			
		||||
    srcdir=.
 | 
			
		||||
fi
 | 
			
		||||
. ${srcdir}/test.rc
 | 
			
		||||
 | 
			
		||||
export MSG="fwd and allow"
 | 
			
		||||
 | 
			
		||||
cat <<EOF >${CONFD}/fwd.conf
 | 
			
		||||
ntp.*	@127.0.0.2:${PORT2}	;RFC5424
 | 
			
		||||
EOF
 | 
			
		||||
 | 
			
		||||
cat <<EOF >${CONFD2}/50-default.conf
 | 
			
		||||
*.*	${LOG2}			;RFC5424
 | 
			
		||||
EOF
 | 
			
		||||
 | 
			
		||||
../src/syslogd -a 127.0.0.2:${PORT} -b :${PORT2} -d -F -f ${CONF2} -p ${SOCK2} &
 | 
			
		||||
echo "$!" > ${PID2}
 | 
			
		||||
 | 
			
		||||
kill -HUP `cat ${PID}`
 | 
			
		||||
sleep 2
 | 
			
		||||
 | 
			
		||||
# Enable debug for second syslogd
 | 
			
		||||
kill -USR1 `cat ${PID2}`
 | 
			
		||||
 | 
			
		||||
../src/logger -t fwd -p ntp.notice -u ${SOCK} -m "NTP123" ${MSG}
 | 
			
		||||
sleep 3
 | 
			
		||||
grep "fwd - NTP123 - ${MSG}" ${LOG2}
 | 
			
		||||
@@ -10,6 +10,12 @@ cat <<EOF > ${CONF}
 | 
			
		||||
include ${CONFD}/*.conf
 | 
			
		||||
EOF
 | 
			
		||||
 | 
			
		||||
mkdir -p ${CONFD2}
 | 
			
		||||
cat <<EOF > ${CONF2}
 | 
			
		||||
# Nothing here yo
 | 
			
		||||
include ${CONFD2}/*.conf
 | 
			
		||||
EOF
 | 
			
		||||
 | 
			
		||||
cat <<EOF > ${CONFD}/foo.conf
 | 
			
		||||
# Local log file, avoid sync to disk
 | 
			
		||||
*.*	-${LOG}
 | 
			
		||||
 
 | 
			
		||||
@@ -17,3 +17,4 @@ rm -f ${CAP}
 | 
			
		||||
rm -f ${SOCK}
 | 
			
		||||
rm -f ${CONF}
 | 
			
		||||
rm -rf ${CONFD}
 | 
			
		||||
rm -rf ${CONFD2}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,20 @@
 | 
			
		||||
NM=syslog-test
 | 
			
		||||
NM2=syslog-test2
 | 
			
		||||
LOG=/tmp/${NM}.log
 | 
			
		||||
LOG2=/tmp/${NM2}.log
 | 
			
		||||
LOGV1=/tmp/${NM}-v1.log
 | 
			
		||||
LOGCONS=/tmp/${NM}-cons.log
 | 
			
		||||
PID=/tmp/${NM}.pid
 | 
			
		||||
PID2=/tmp/${NM2}.pid
 | 
			
		||||
CAP=/tmp/${NM}.pcapng
 | 
			
		||||
CONF=/tmp/${NM}.conf
 | 
			
		||||
CONF2=/tmp/${NM2}.conf
 | 
			
		||||
CONFD=/tmp/${NM}.d
 | 
			
		||||
CONFD2=/tmp/${NM2}.d
 | 
			
		||||
SOCK=/tmp/${NM}.sock
 | 
			
		||||
SOCK2=/tmp/${NM2}.sock
 | 
			
		||||
ALTSOCK=/tmp/${NM}-alt.sock
 | 
			
		||||
PORT=5514
 | 
			
		||||
PORT2=5555
 | 
			
		||||
 | 
			
		||||
export SYSLOG_UNIX_PATH=${SOCK}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user