Einfache Möglichkeit, Syslog über TCP zu generieren?

Ich möchte das Problem mit dem Logstash-Server beheben und muss gelegentlich eine Syslog-Nachricht generieren. Gibt es eine einfache Möglichkeit, über TCP eine Verbindung zu einem Syslog-Server herzustellen und beliebige Syslog-Nachrichten zu senden?

Author: fixer1234, 2017-07-13

1 answers

Netcat

Senden Sie jede Zeile von file.log in Richtung syslog Server 127.0.0.1 auf Port 514

nc -q0 127.0.0.1 514 < file.log

Senden Sie eine einfache Zeichenfolge, die einen einzelnen Protokolleintrag generiert:

echo "message" | nc -q0 127.0.0.1 514

-q0 macht nc beenden nach dem Senden:

- q Sekunden nach EOF auf stdin, warten Sie die angegebene Anzahl von Sekunden und dann beenden.

Tcpflood

Das Dienstprogrammtcpflood bietet viele nützliche Optionen. Unten ist eine kleine Teilmenge von tcpflood Optionen:

-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
 11
Author: Gohu,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/techietown.info/template/agent.layouts/content.php on line 61
2017-07-13 07:59:39