nginx默认日志文件:access.log(格式如下)
192.168.1.1 - - [09/Aug/2021:20:08:26 +0800] "GET /img/xx.jpg.jpg HTTP/1.1" 200
192.168.1.1 - - [09/Aug/2021:20:30:30 +0800] "GET /img/xx.jpg.jpg HTTP/1.1" 404
过滤当天晚上8点到9点日志
[root@Mankel ~] cat access.log |egrep "09/Aug/2021" |sed -n '/20:00:00/,/21:00:00/p'
然后过滤状态码为404的日志
[root@Mankel ~] cat access.log |egrep "09/Aug/2021" |sed -n '/20:00:00/,/21:00:00/p'|awk '{if($9 == 404) print }'