linux通过跳板机查询多台服务器日志

例如跳板机可登录ip有下:

192.168.100.1

192.168.100.252

192.168.100.8

192.168.100.7

192.168.100.11

192.168.100.9

192.168.100.5

192.168.100.6

192.168.100.3

192.168.100.2

192.168.100.10

192.168.100.4

可使用循环语句查询每台机器:
for newcore_ip in 192.168.100.1 192.168.100.252 192.168.100.8 192.168.100.7 192.168.100.11 192.168.100.9 192.168.100.5 192.168.100.6 192.168.100.3 192.168.100.2 192.168.100.10 192.168.100.4; do echo -e "目标服务器:${newcore_ip}"; ssh -l log "${newcore_ip}" cat 目录/xxx.log.2020-08-19 |grep '条件'; done ;

posted @ 2020-08-20 10:54  宇枫  阅读(1575)  评论(0编辑  收藏  举报