mil*_*dos 38
我的首选选择是使用多尾。我会运行类似的东西:
multitail -l 'ssh user@host1 "tail -f /some/log/file"' -l 'ssh user@host2 "tail -f /some/log/file"'
Run Code Online (Sandbox Code Playgroud)
ein*_*ien 31
这对我有用:
ssh -n user@hostname1 'tail -f /mylogs/log' &
ssh -n user@hostname2 'tail -f /mylogs/log' &
Run Code Online (Sandbox Code Playgroud)
小智 8
您可以使用结构来跟踪多个主机(如果需要,还可以使用grep 结果):
$ fab -P -u 'USER' -p 'PASSWORD' --linewise -H host1,host2,host3 -- tail -f /path/to/my/log.log | grep ERROR
Run Code Online (Sandbox Code Playgroud)
小智 6
我在想也可以使用:
ssh -f user@hostname1 "tail -f /var/log/file" > /tmp/somefile &
ssh -f user@hostname2 "tail -f /var/log/file" > /tmp/somefile &
Run Code Online (Sandbox Code Playgroud)
ssh 后面的 -f 选项允许您在后台运行之前输入密码。然后,您可以将逐行结果保存在单个文件中并运行:
tail -f /tmp/somefile
Run Code Online (Sandbox Code Playgroud)
如果您想使用其他尾部选项来显示输出,将使您对当前的“tail”命令有更多的控制。