GNU parallel is a shell tool for executing jobs in parallel using one or more computers. If you have a set of servers to ssh into and run a command in parallel, this tool will help you.
Assuming you have an architecture where several cloud instances are behind LB, but doesn’t have a centralized logging sync (Logging into a centralized server or service, like Splunk):
If you need to search the log files across all the servers with one command, GNU Parallel comes very handy saving a lot of time. Here’s how it works:
Install GNU Parallel. (Below command for Ubuntu)
sudo apt-get install parallel
Run the tool:
echo “command” | parallel –onall –slf servers.txt
A few other way to run the command:
- echo “fgrep -Rl
/var/log/” | parallel –onall –slf servers.txt - echo “grep
~/log.txt” | parallel –onall –slf servers.txt