I was hoping to have multiple clients reading from /dev/log (rsyslog and a custom tool) which I understand is a unix domain socket.
How can this be achieved?
I was hoping to have multiple clients reading from /dev/log (rsyslog and a custom tool) which I understand is a unix domain socket.
How can this be achieved?
In theory you could open a process which opens the socket, forks and each of the clients can then read from the socket. But the end result is probably not what you want. Since every read will remove the data from the socket buffer only one of the processes will get the data, i.e. depending on the scheduling sometimes the first child and sometimes the second child.
But I guess that you want to have all the readers get all data. In this case you need to have some kind of replicator, i.e. a process which reads the data from the socket and replicates these data for all readers attached (with socket or whatever) to this replicator process.
syslog/rsyslog can be such a replicator, so you need to attach your custom reader there instead.
I'm not sure you can do that (since I don't believe it is a seekable file, but a stream of bytes), but you can have rsyslog write to multiple files, including have it write to, for example, a named pipe, that your custom tool can read from. That would probably be the easiest solution.