network logging via djb's multilog
November 8, 2007
Had this recipe stuck in an old email somewhere, hope this helps someone else
The attached run files are required for the server who captures logs and the client which will send the logging data request.
Server
#!/bin/sh export PATH=”/usr/local/bin:$PATH” setuidgid remoteloguser tcpserver ip-addr-of-server listen-port-on-server multilog ./log
Client
#!/bin/sh export PATH=”/usr/local/bin:$PATH” 4>&1 | tcpclient ipaddr-of-server listen-port-on-server 6<&0
Categories: General
The Server side worked for me. I used as:
#!/bin/sh
export PATH=”/usr/local/bin:$PATH”
tcpserver 10.216.204.32 7777 multilog ./log
But, the suggested Client Side script did not work for me.
The below one worked for me (standard input logged to the log server):
cat | tcpclient 10.216.204.32 7777 sh -c “cat >&7”
Similarly:
qlogtools-3.1/multitail /var/log/apache_error_log | tcpclient 10.216.204.32 7777 sh -c “cat >&7”
Here I tried using qlogtools’ multitail to pipe the error log to remote log server (10.216.204.32).