0

I have an output of the access log and I need to get the Ip address plus the date/time of it. The problem I am facing is when I need to filter the output mainly on the IP address and count the occurrence of it , I am having a duplicate of the IP if it's visiting my web server on different time, So how can i merge the date in such a situation

sudo zcat /var/log/nginx/access.log.2.gz | awk '{print $1 " " $4 " "$5}'| sort | uniq -c |sort -nr

 I expected this 
  1 77.222.139.* [23/Dec/2018:06:25:17]
  1 77.21.47.* [23/Dec/2018:15:21:38]
  1 76.231.246.* [23/Dec/2018:21:19:03]
  1 71.6.202.* [24/Dec/2018:05:34:20]
  2 69.58.178.* [23/Dec/2018:23:01:33]

but got this

  1 77.222.139.* [23/Dec/2018:06:25:17]
  1 77.21.47.* [23/Dec/2018:15:21:38]
  1 76.231.246.* [23/Dec/2018:21:19:03]
  1 71.6.202.* [24/Dec/2018:05:34:20]
  1 69.58.178.* [23/Dec/2018:23:01:33]
  1 69.58.178.*[23/Dec/2018:23:01:32]
Ulrich Eckhardt
  • 16,572
  • 3
  • 28
  • 55

0 Answers0