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



## japoc (Jul 21, 2019)

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.


----------



## leebrown66 (Jul 21, 2019)

Listen:

```
nc -U -l /tmp/test.sock
```

Send:

```
echo Hello | nc -N -U /tmp/test.sock
```


----------

