How to send a message to a unix domain socket on the command line?

japoc

Active Member

Reaction score: 1
Messages: 102

Hello,

I'm trying so send my nginx logs to syslog-ng via a unix socket. It doesn't work (otherwise I wouldn't be posting).
I think nginx doesn't send anything to the socket, but I'd like to check if, when I send something to the socket, something can be received on the other end.
How would I achieve that?

To listen to the socket (located at /var/run/nginx-syslog.sockets) I'm doing:

nc -U /var/run/nginx-syslog.sockets

Is that the correct way to listen to what is sent to a unix domain socket?

If so, how can I send something to it? I didn't find any way to send a message to the socket from the command line.
I tried
echo "hello" | nc -U /var/run/nginx-syslog.sockets
but it hangs forever when I do that.

Thanks for your help.
 
Top