Telnet failed to localhost.

Hi,

I am trying telnet to localhost 514. But the connection is refusing.

Port does not appear in netstat. IP table service is also off.

What TCP service do you expect to be listening on port 514 on localhost?

I want to collect logs from different hosts, therefore I am checking is the port 514 is open or not.

Hi,

Port 514 is the port for the syslog service, as you seem to have already determined. However, in those instances where a local logging service is configured to listen for incoming connections on port 514 it almost always uses UDP rather than TCP, so you can't test this by attempting to telnet to the port.

Exactly how you'd configure this all to work depends on your exact version of UNIX/your Linux distribution, what software you're using for logging, and of course if there is some external firewall that could be in the way even if your own local firewall definitely is not. But the best way to test it is to try to generate a logged event on a remote system that you have configured to log to your syslog server, and see if something gets logged or not.

1 Like

removed ... inadequate.

You could try using netcat (or nc ) instead with the -u option:

if nc -u localhost. 514 2>/dev/null <<< $'\n'; then
  echo udp port open
else
  echo udp port closed
fi