title: 监控服务器Java异常脚本
date: 2017-02-13 09:59:53
tags: bash
tail -f /log/app/app.log|grep -P "(^ at |Exception|^Caused by: | ... d+ more)"
tail -f filename 可以加多个 -f fileName实现同时监控多个
tail -f /log/app/app.log -f /log/app/asyn.log|grep -P "(^ at |Exception|^Caused by: | ... d+ more)"
如果log日志前缀一样也可以这样写
tail -f /log/app/app_*.log|grep -P "(^ at |Exception|^Caused by: | ... d+ more)"
重定向到文件
tail -f /log/app/app.log|grep -P "(^ at |Exception|^Caused by: | ... d+ more)">>birkhoff/error.log