Duplicate unix input stream to multiple TCP clients (using socat)

I have a syslog server that writes to the unix stream /tmp/syslog.socket . I need to duplicate this thread to multiple TCP clients. Is there any way to achieve this with socat?

+4
source share
2 answers

I think I just did this, especially the duplicate part, using some useful socat commands .

 socat TCP-LISTEN:4444,reuseaddr,fork SYSTEM:"tail -f ~/.tail-error-logs/*",pty 

fork is important on the left, pty is important on the right.

What doesn't work was netcat style:

 tail -f ~/.tail-error-logs/* | socat STDIO TCP-LISTEN:4444,fork,reuseaddr 

It had the effect of output alternating between several affiliate clients, which is also documented on this website .

+2
source

syslogd has the ability to redistribute logs through udp, see the man page for syslogd, i.e.

http://linux.about.com/od/commands/l/blcmdl8_syslogd.htm

I believe syslog-ng also supports tcp sockets for log redistribution as well as udp

http://www.syslog.org/syslog-ng/v2/

I would suggest that you do not need hacking with socat?

+1
source

Source: https://habr.com/ru/post/1393243/


All Articles