截取系统日志

截取日志某一个时间段应用的运行情况

案例:日志格式类型 [2023-07-21T17:33:24,507]

awk

 awk -F '[][]' '$2 >= "2023-07-21T17:33:58" && $2 <= "2023-07-21T17:34:27"'  nohup.out

grep

 十秒内
 ​
  egrep '2023-07-21T17:33:2[4-9]' nohup.out 
 ​
 ​
 ​
 一分钟内
 ​
  egrep '2023-07-21T17:33:[3-5][4-9]' nohup.out 
 ​
 ​
 ​
 分钟、秒
 ​
 egrep '2023-07-21T17:3[3-4]:[2-3][4-9]' nohup.out 
 ​
 ​

猜你喜欢

转载自blog.csdn.net/weixin_44815878/article/details/131964245