1. install expect module.
2. write logcollect.exp file
set USERNAME "fishyych"
set CMD_PROMPT "]*"
set REMOTE_SERVER [lindex $argv 0]
set TARGET_FILENAME [lindex $argv 2]
set TARGET_FOLDER [lindex $argv 1]
set timeout 30
spawn ssh $USERNAME@jumpserver
expect $CMD_PROMPT
set timeout -1
send "scp $REMOTE_SERVER:/opt/tomcat/logs/catalina.out.1.gz ~/$TARGET_FILENAME\r"
expect $CMD_PROMPT
send "exit\r"
set timeout -1
spawn scp $USERNAME@jumpserver:~/$TARGET_FILENAME $TARGET_FOLDER/$TARGET_FILENAME
expect $CMD_PROMPT
3. write run.sh
#!/bin/sh
TARGET_FOLDER="logbackup"
cat serverlist | while read REMOTE_SERVER
do
echo "getting catalina.out from server $REMOTE_SERVER..."
TARGET_FILENAME=`date +%F`-$REMOTE_SERVER-catalina.out.gz
./logcollect.exp $REMOTE_SERVER $TARGET_FOLDER $TARGET_FILENAME
echo "log saved locally finished."
done
分享到:
相关推荐
It is used to stream logs from application servers to HDFS for ad hoc analysis. This book starts with an architectural overview of Flume and its logical components. It explores channels, sinks, and ...
COLLECT
collect_aws_logs 将 AWS CloudWatch 日志检索到本地机器 安装 安装 Python 3。 安装博托。 安装 AWS CLI。 从命令行配置您的访问密钥。 更改 collect.py 头文件中的任何变量。 它默认拉取最后 20 分钟的日志。...
官方离线安装包,亲测可用
离线安装包,亲测可用
How to collect 10046 trace_Chinese
abap collect的用法与实例 abap collect的用法与实例
com.google.common.collect.Maps; Maps.newConcurrentMap();
Oracle 中使用 fetch bulk collect into 批量效率的读取游标数据
how to collect logs from your applications, as well as Kubernetes with Elasticsearch, Fluentd, and Kibana stack. Ensuring a service is up and healthy is one of the major responsibilities of DevOps. ...
how to collect logs from your applications, as well as Kubernetes with Elasticsearch, Fluentd, and Kibana stack. Ensuring a service is up and healthy is one of the major responsibilities of DevOps. ...
Collect是用 Visual C++ 语言开发的
How To Collect Bank Info..
google-collect-1.0-rc1.jar 用于获取Lists.newArrayList
详细介绍了使用 BULK COLLECT 进行批量操作 提高sql的执行效率 使用MERGE INTO USING 一条sql搞定 新增和修改 使用connect by 进行递归树查询
DTC_Collect.c
unix shell scripts used to collect OS and network metrics
结合一个存储过程的实例,介绍了 bulk collect 的使用
采用bulk collect可以将查询结果一次性地加载到collections中。而不是通过cursor一条一条地处理。可以在select into,fetch into,returning into语句使用bulk collect。注意在使用bulk collect时,所有的into变量都...