× NETGEAR will be terminating ReadyCLOUD service by July 1st, 2023. For more details click here.
Orbi WiFi 7 RBE973
Reply

UDP 514 port open for remote logging on syslogd . HELP!

horim80
Guide

UDP 514 port open for remote logging on syslogd . HELP!

Hi,

I want to remote logging on readynas.

So I did below,

ReadyNAS-PRO:/# vim /etc/init.d/sysklogd


# then I've added below line for receive log from remote device.

SYSLOGD="-r -m 0"


then I restart the syslogd


ReadyNAS-PRO:/# /etc/init.d/sysklogd restart
Restarting system log daemon: syslogd.


and check the udp 514 port open


ReadyNAS-PRO:/# netstat -an | grep :514
udp 0 0 0.0.0.0:514 0.0.0.0:*


finally it work well and receive log from remote device successfully.

BUT, when I reboot the NAS, upd 514 port blocked again....
netstat -an | grep :514 --> nothing..

For work properly, I have to restart the syslogd manually...

How can I open the udp 514 port consistently?
Message 1 of 9
CharlesLaCour
Aspirant

Re: UDP 514 port open for remote logging on syslogd . HELP!

If you added the "SYSLOGD="-r -m 0" before the line "test ! -r /etc/default/syslogd || . /etc/default/syslogd" the SYSLOGD far able was redefined.

You should edit the file "/etc/default/syslogd" and modify the definition of SYSLOGD in there.
Message 2 of 9
horim80
Guide

Re: UDP 514 port open for remote logging on syslogd . HELP!

CharlesLaCour wrote:
If you added the "SYSLOGD="-r -m 0" before the line "test ! -r /etc/default/syslogd || . /etc/default/syslogd" the SYSLOGD far able was redefined.

You should edit the file "/etc/default/syslogd" and modify the definition of SYSLOGD in there.


I also added "SYSLOGD="-r -m 0" to "/etc/default/syslogd" as you said but it doesn't work either.. 😞


/etc/init.d/sysklogd

#! /bin/sh
# /etc/init.d/sysklogd: start the system log daemon.

SYSLOGD="-r -m 0"

PATH=/bin:/usr/bin:/sbin:/usr/sbin

pidfile=/var/run/syslogd.pid
binpath=/sbin/syslogd

test -x $binpath || exit 0

test ! -r /etc/default/syslogd || . /etc/default/syslogd

create_xconsole()
{
if [ ! -e /dev/xconsole ]; then
mknod -m 640 /dev/xconsole p
else
chmod 0640 /dev/xconsole
fi
chown root:adm /dev/xconsole
}

running()
{
# No pidfile, probably no daemon present
#
if [ ! -f $pidfile ]
then
return 1
fi

pid=`cat $pidfile`

# No pid, probably no daemon present
#
if [ -z "$pid" ]
then
return 1
fi

if [ ! -d /proc/$pid ]
then
return 1
fi

cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1`

# No syslogd?
#
if [ "$cmd" != "$binpath" ]
then
return 1
fi

return 0
}

case "$1" in
start)
echo -n "Starting system log daemon: syslogd"
create_xconsole
start-stop-daemon --start --quiet --exec $binpath -- $SYSLOGD
echo "."
;;
stop)
echo -n "Stopping system log daemon: syslogd"
start-stop-daemon --stop --quiet --exec $binpath --pidfile $pidfile
echo "."
;;
reload|force-reload)
echo -n "Reloading system log daemon: syslogd"
start-stop-daemon --stop --quiet --signal 1 --exec $binpath --pidfile $pidfile
echo "."
;;
restart)
echo -n "Restarting system log daemon: syslogd"
start-stop-daemon --stop --quiet --exec $binpath --pidfile $pidfile
sleep 1
start-stop-daemon --start --quiet --exec $binpath -- $SYSLOGD
echo "."
;;
reload-or-restart)
if running
then
echo -n "Reloading system log daemon: syslogd"
start-stop-daemon --stop --quiet --signal 1 --exec $binpath --pidfile $pidfile
else
echo -n "Restarting system log daemon: syslogd"
start-stop-daemon --start --quiet --exec $binpath -- $SYSLOGD
fi
echo "."
;;
*)
echo "Usage: /etc/init.d/sysklogd {start|stop|reload|restart|force-reload|reload-or-restart}"
exit 1
esac

exit 0





/etc/default/syslogd

#
# Top configuration file for syslogd
#

#
# Full documentation of possible arguments are found in the manpage
# syslogd(8).
#

#
# For remote UDP logging use SYSLOGD="-r"
#
SYSLOGD="-r -m 0"



Any advice?
Message 3 of 9
CharlesLaCour
Aspirant

Re: UDP 514 port open for remote logging on syslogd . HELP!

All I did was edit my "/etc/default/syslogd" file like this:
#
# Top configuration file for syslogd
#

#
# Full documentation of possible arguments are found in the manpage
# syslogd(8).
#

#
# For remote UDP logging use SYSLOGD="-r"
#
SYSLOGD="-r"


Ran the command:
/etc/init.d/sysklogd restart


Looking at the processes bound to ports I see:
mynas:~# lsof -i -nP | grep ':514'
syslogd 24688 root 18u IPv4 872288 UDP *:514


What do you get when you run the command:
/etc/init.d/sysklogd restart
Message 4 of 9
horim80
Guide

Re: UDP 514 port open for remote logging on syslogd . HELP!

I have question to you.
udp 514 port still open after reboot the NAS?

I configured the NAS completely same as you.
I restart the syslogd then udp 514 port opened. yes it works at this time.
but it stop work after I reboot the NAS. udp 514 is not opened.
This is problem..
Message 5 of 9
burokio
Aspirant

Re: UDP 514 port open for remote logging on syslogd . HELP!

Have you ever found a solution to this problem? I am having exactly the same issue, remote logging does not work after reboot. If i look at the list of processes after reboot I see that syslogd was started without the -r switch. After I manually restart it (sysklogd restart) - it starts with -r switch and remote loging works as expected. I've made exactly the same changes to /etc/init.d/sysklogd as shown in the first post.
Message 6 of 9
horim80
Guide

Re: UDP 514 port open for remote logging on syslogd . HELP!

burokio wrote:
Have you ever found a solution to this problem? I am having exactly the same issue, remote logging does not work after reboot. If i look at the list of processes after reboot I see that syslogd was started without the -r switch. After I manually restart it (sysklogd restart) - it starts with -r switch and remote loging works as expected. I've made exactly the same changes to /etc/init.d/sysklogd as shown in the first post.


I have resolved this problem~!

1. edit /etc/default/syslogd

SYSLOGD="-r -m0"


2. add some line to /etc/syslog.conf

local7.debug                    -/var/log/gs108t.log


3. create a script at /etc/init.d/ like a below.


#! /bin/sh

/etc/init.d/sysklogd restart

exit 0


4. update script to rc.

update-rc.d script-name defaults


that's it.

UDP 514 still opened after reboot!
Message 7 of 9
CharlesLaCour
Aspirant

Re: UDP 514 port open for remote logging on syslogd . HELP!

The /etc/inittab defined the default init level as 2 and looking into /etc/rc2.d there are 2 scripts called /etc/init.d/readynas_startup and /etc/rc2.d/S02ToggleSwitchProCPUFan.

Looking at the file "/etc/init.d/readynas_startup" around line 375 you have:
# RC2
echo -n "Starting system log daemon: syslogd" >$OUT
mknod -m 640 /dev/xconsole p
sync
/sbin/syslogd -m 0 || (echo "...retrying"; sleep 1; /sbin/syslogd -m 0)
echo "." >$OUT

The syslogd is not started using the standard /etc/init.d/sysklogd script it calls the daemon directly.

I made the following changes to "/etc/init.d/readynas_startup":
# RC2
echo -n "Starting system log daemon: syslogd" >$OUT
mknod -m 640 /dev/xconsole p
sync
. /etc/default/syslogd
/sbin/syslogd ${SYSLOGD}-m 0 || (echo "...retrying"; sleep 1; /sbin/syslogd ${SYSLOGD} -m 0)
echo "." >$OUT
Message 8 of 9
horim80
Guide

Re: UDP 514 port open for remote logging on syslogd . HELP!

CharlesLaCour wrote:
The /etc/inittab defined the default init level as 2 and looking into /etc/rc2.d there are 2 scripts called /etc/init.d/readynas_startup and /etc/rc2.d/S02ToggleSwitchProCPUFan.

Looking at the file "/etc/init.d/readynas_startup" around line 375 you have:
# RC2
echo -n "Starting system log daemon: syslogd" >$OUT
mknod -m 640 /dev/xconsole p
sync
/sbin/syslogd -m 0 || (echo "...retrying"; sleep 1; /sbin/syslogd -m 0)
echo "." >$OUT

The syslogd is not started using the standard /etc/init.d/sysklogd script it calls the daemon directly.

I made the following changes to "/etc/init.d/readynas_startup":
# RC2
echo -n "Starting system log daemon: syslogd" >$OUT
mknod -m 640 /dev/xconsole p
sync
. /etc/default/syslogd
/sbin/syslogd ${SYSLOGD}-m 0 || (echo "...retrying"; sleep 1; /sbin/syslogd ${SYSLOGD} -m 0)
echo "." >$OUT



Thanks! It worked.
Message 9 of 9
Top Contributors
Discussion stats
  • 8 replies
  • 6054 views
  • 0 kudos
  • 3 in conversation
Announcements