linux 查看tomcat日志 关键字
轉載:https://blog.csdn.net/u013410747/article/details/71192140
1
cat app.log |grep ‘error’
grep -C 100 ‘error’ app.log
2.查詢日志尾部最后10行的日志
tail -n 10 app.log
3.查詢10行之后的所有日志
tail -n +10 app.log
4.查詢日志文件中的頭10行日志
head -n 10 app.log
5.查詢日志文件除了最后10行的其他所有日志
head -n -10 app.log
6.查詢日志中含有某個關鍵字的信息,顯示出行號(在1的基礎上修改)
cat -n app.log |grep ‘error’
7.顯示102行,前10行和后10行的日志
cat -n app.log |tail -n +92|head -n 20
8.根據日期時間段查詢(前提日志總必須打印日期,先通過grep確定是否有該時間點)
sed -n ‘/2014-12-17 16:17:20/,/2014-12-17 16:17:36/p’ app.log
9.使用more和less命令(分頁查看,使用空格翻頁)
cat -n app.log |grep “error” |more
10.吧日志保存到文件
cat -n app.log |grep “error” > temp.txt
總結
以上是生活随笔為你收集整理的linux 查看tomcat日志 关键字的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Datawhale组队-Pandas(下
- 下一篇: linux 其他常用命令