Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

How to fetch logs from diffrent servers using one command?

For example, suppose I want to fetch logs for same id in different servers. I have to go to each server and search for logs.

Is there any way to do it one go?

share|improve this question

closed as not a real question by Gilles, Renan, maxmackie, jasonwryan, Ulrich Dangel Mar 19 '13 at 0:04

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
What logs? What ID? –  jordanm Mar 18 '13 at 15:08
1  
Why do you need to do it in a single command? Isn't scp foo:/var/log/messages . && scp bar:/var/log/messages . enough? –  l0b0 Mar 18 '13 at 15:24

1 Answer 1

You could do it with a for loop in bash.

for SERVER in foo bar
do
mkdir -p $SERVER
scp $SERVER:/var/log/messages $SERVER/
done

Replace foo and bar with the names of your servers.

share|improve this answer