Syslog and NetCat

Sometimes you may need to generate or spoof a network client. In this case I was trying to find out why a logstash server was not receiving log messages. Netcat to the rescue.

echo '<147>1 2015-07-22T09:04:15.12Z 172.16.89.101 netcat 1234 TESTER Log me baby!' | nc -v -u -w 0 172.16.89.132 514

NetCat switches:

  • -v verbose
  • -u UDP packets
  • -w Wait timeout

More on the syslog packets can be found in RFC5425

Leave a Reply