Thursday, 7 March 2013

Getting log files from different servers using SSH


I've got a list of servers 1-10, Using this command I am able to search into these log files

$ for h in 1 2 3 4 5 6 7 8 9 10; do ssh user@$h.hostname  'echo "server'$h'";cat /var/log/file.log | grep 2342343423';done