There is a file log site text.log .

From it you need to make a selection by date, at the get request, the response of the server is not HTTP 403 and not HTTP 404 .

What should be the command syntax?

Sample file content:

37.55.12.210 - - [16 / Jan / 2014: 17: 38: 21 +0200] "anchor.in.ua" "GET / mechanical? $

178.44.166.223 - - [16 / Jan / 2014: 17: 38: 21 +0200] "b-56.ru" "GET / company / divany $

83.167.122.26 - - [16 / Jan / 2014: 17: 38: 21 +0200] "gmod-play.ru" "GET /index.php?$

157.55.32.80 - - [16 / Jan / 2014: 17: 38: 22 +0200] "htcunlockingservice.com" "GET / $

157.55.32.80 - - [16 / Jan / 2014: 17: 38: 22 +0200] "htcunlockingservice.com" "GET / $

  • cat text.log | grep% date% | grep GET - etki
  • Thank. I will try. there is still a condition сервера the answer of the server is not HTTP 403 and not HTTP 404 - ServerZ
  • (I don’t remember how an or-pattern is set for the grep, that's why) cat text.log | grep% date% | grep GET | grep -v 404 | grep -v 403 - etki
  • At the end of all this, the resulting sample should be saved to a file, and each line should contain only the IP address, date, time, site name. - ServerZ
  • @SergioUser, complete the question. Place in it for example a few lines of the log. - avp

1 answer 1

the answer from the comment to the question.

For example:

 $ grep 16/Jan/2014 ./access.log | grep -v 'HTTP.*40[43]' |\ awk '$7 ~/GET/ {print $1 " " $4 $5 " " $6}'