Linux uses the grep command to view logs for a specified period of time
Today, I checked the problem of repeated orders. Since the order has been generated for a while, I must perform log queries accurately. At the beginning, I used the sed command query method, and later changed it to grep query, which is very convenient.
For example: I want to check the log information between 11:34 and 11:37 on November 6, 2018 in the shop-bussiness.log.2018-11-06 file, I can do this:
Command: grep 'time' 'log file name'
grep '2018-Nov-06 11:3[4-7]' shop-bussiness.log.2018-11-06
copy
The results of the detection are as shown in the figure below, and the end is exactly 37 points:
0 Comments