Tailing Log Files Across Multiple Servers post
Posted on 2014-02-12 by jwage
Install the utility named dsh
:
apt-get install dsh
brew install dsh
Add the list of servers you want to work with to .dsh/machines.list
in your home directory. It might look something like this:
web1.prod.domain.com
web2.prod.domain.com
web3.prod.domain.com
web4.prod.domain.com
web5.prod.domain.com
web6.prod.domain.com
Add this to your .ssh/config
:
Host web*.prod.domain.com
User your_username
Now you can do things like this:
dsh -Mac -- "tail -f /var/log/some_log_file.log"
Combine that with grep to look for certain things that you are logging:
dsh -Mac -- "tail -f /var/log/some_log_file.log" | grep "look for something"