S
S
SyRock2020-05-14 16:04:57
linux
SyRock, 2020-05-14 16:04:57

How to grep the desired text in the logs by date and time?

It is necessary to crack on 12/30/2019 from 21:30:00 to 21:39:59 errors with number 400.
This is how the log file looks like, if necessary.


...
68.134.41.162 - - [12/30/2019:22:12:25 +0000] "POST /customers HTTP/1.1" 400 3012
203.106.235.105 - - [12/30/2019:22:12:38 +0000] "DELETE /events HTTP/1.1" 400 4158
18.211.28.150 - - [30/12/2019:22:12:40 +0000] "DELETE /collectors HTTP/1.1" 400 2212
229.16.123.45 - - [30 /12/2019:22:12:54 +0000] "GET /auth HTTP/1.1" 400 2397
...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vreitech, 2020-05-14
@SyRock

grep -P '30\/12\/2019:21:3.*?\/1\.1\"\s400'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question