Simple way to generate syslog over TCP?

I want to troubleshoot logstash server issue and need to generate syslog message from time to time. Is there a simple way that allows me to connect to a syslog server using TCP and send some arbitrary syslog messages?

1 Answer

Netcat

Send each line of file.log towards syslog server 127.0.0.1 on port 514

nc -q0 127.0.0.1 514 < file.log

Send a simple string that will generate a single log entry:

echo "message" | nc -q0 127.0.0.1 514

-q0 makes nc exit after sending:

-q seconds after EOF on stdin, wait the specified number of seconds and then quit.

Tcpflood

The tcpflood utility has quite a lot of useful options. Below is a small subset of tcpflood options:

-t target address (default 127.0.0.1)
-p target port (default 13514)
-c number of connections (default 1)
-m number of messages to send (connection is random)
-M the message to be sent. Disables all message format options, as only that exact same message is sent.
-I read specified input file, do NOT generate own test data. The test completes when eof is reached.
-D randomly drop and re-establish connections. Useful for stress-testing the TCP receiver.
-T transport to use. Currently supported: "udp", "tcp" (default) Note: UDP supports a single target port, only
3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like