linux日志文件过大,想要截取执行时间的日志信息 如何截取

 1.首先第一步查看你日志的时间格式:

09:28:06,651 ERROR [stderr] (http-/0.0.0.0:8080-1) org.springframework.jdbc.BadSqlGrammarException: 
09:28:06,656 ERROR [stderr] (http-/0.0.0.0:8080-1) ### Error updating database.  Cause: java.sql.SQLSyntaxErrorException: ORA-01745: invalid host/bind variable name
09:28:06,656 ERROR [stderr] (http-/0.0.0.0:8080-1) 
09:28:06,656 ERROR [stderr] (http-/0.0.0.0:8080-1) ### The error may involve com.deppon.qms.module.lostgoodswarning.pojo.TLostReportFlowcodeEntity.insertForBatch-Inline
09:28:06,656 ERROR [stderr] (http-/0.0.0.0:8080-1) ### The error occurred while setting parameters
09:28:06,656 ERROR [stderr] (http-/0.0.0.0:8080-1) ### Cau


以上可以看出  日志时间是以 09:28:06,656  这种形式的

会正则 表达式 就可以这匹配 09:[0-9][0-9]  我取的 是九点钟的所以简单点儿 命令如下

sed -n '/09:[0-9][0-9]/,/09:[0-9][0-9]/p' server.log>new.log

猜你喜欢

转载自blog.csdn.net/jiewenike/article/details/54311008