监控服务器Java异常脚本

tail -f /log/app/app.log|grep -P "(^\tat |Exception|^Caused by: |\t... \d+ more)"

tail -f filename 可以加多个 -f fileName实现同时监控多个

tail -f /log/app/app.log -f /log/app/asyn.log|grep -P "(^\tat |Exception|^Caused by: |\t... \d+ more)"

如果log日志前缀一样也可以这样写

tail -f /log/app/app_*.log|grep -P "(^\tat |Exception|^Caused by: |\t... \d+ more)"

重定向到文件

tail -f /log/app/app.log|grep -P "(^\tat |Exception|^Caused by: |\t... \d+ more)">>birkhoff/error.log
文章目录
|