Start by looking at the log to see how you would identify a line which contains a connection from an IP address. This will be the rule for your first grep. If the whole log is just connections you don't need this stage.
Then look at sample connection lines and come up with some simple way of defining where the IP address is on that line (e.g. 5th space-delimited field). This will dictate your method to extract the IP address prior to sorting and counting. (If you have not studied "awk" this might just involve using "cut").
If there is no clear rule to fish out the IP address then you could be looking at a grep which finds patterns like nnn.nnn.nnn (or nnn.nnn.nnn.nnn if this is IP6) where nnn is a number 0-255 . Let's hope it is a simple format log.
We don't know what your log file looks like. Can you post a couple of sample lines.
There is a current thread on this board which may get you started on how to count occurances in a list.
https://www.unix.com/unix-dummies-que...xist-file.html