tail -f <(ssh -t host 'tail -f /var/log/sth') <(ssh -t host2 'tail -f /var/log/sth')
+ I need to install nodejs? Those who do not understand Unix are condemned to reinvent it, poorly.Serious question - I actually would like to see how you'd do it.
multitail() {
com="tail -f "
for arg; do
IFS=':' read -a array <<< "$arg"
host="${array[0]}"
file="${array[1]}"
com="$com <(ssh -t $host 'tail -f $file')"
done
eval ${com}
}
This will take the host:file syntax of remtail and turn it into Plugawy's example. I haven't tested it, but if you echo "$com" it'll spit out Plugawy's code. ssh host tail -f /path/to/log
(which is the command that remtail seems to be doing) pssh -H h1 -H h2 -P "tail -n 1000 /var/log/x.log"
It is very easy to install on every platform since is on most package managers.You'll want -i to avoid the buffered output that would make the log output hard to read.
And if your command doesn't contain anything that you need to escape from the shell, you don't need to quote the command.
And finally, since it implements BSD-style short flags correctly, so you can do "-Pi" instead of "-P -i".
Handy with a pre-defined list of hosts, too:
pssh -Pi -H "hosts.txt" tail -f /var/log/haproxy.log
or a specific set of hosts: pssh -Pi -H `cat hosts.txt | grep prod` tail -f /var/log/haproxy.log > You can optionally use a credentials file in ~/.remtail.json of this format:
What ever happened to just using .netrc?http://www.gnu.org/software/inetutils/manual/html_node/The-_...
mssh or cluster ssh is also effective in this manner, with the added flexibility of ssh terminals.
[1] - http://www.tecmint.com/using-dsh-distributed-shell-to-run-li...