Extract the source ip address and destination port :
sed -n 's/^.*SRC=\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\).*DPT=\([0-9]\+\).*$/\1 \2/p' <<< $(sudo cat /var/log/ufw.log) \
| uniq -c \
| sort \
| column -tExample (details omitted for simplicity):
...
[..] SRC=192.168.100.119 DST=192.168.100.1 LEN=40 TOS=0x00 PREC=0x00 TTL=239 ID=1 PROTO=TCP SPT=23 [..]
...
[..] SRC=192.168.100.120 DST=192.168.100.1 LEN=40 TOS=0x00 PREC=0x00 TTL=239 ID=2 PROTO=TCP SPT=23 [..]
Result :
7 192.168.100.119 23
10 192.168.100.120 23