Hello,
I'm looking to refine the following one liner to extract IP addresses, sort and rank them.
I've got so far but need to get rid of the SRC= bit to leave the IP only.
The entry in the logs follows this (IP addresses obfuscated for privacy)
The one liner as it stands is:
The result is :
45 SRC=xxx.xxx.xxx.xxx
49 SRC=xxx.xxx.xxx.xxx
54 SRC=xxx.xxx.xxx.xxx
63 SRC=xxx.xxx.xxx.xxx
... and so on. Is there a tweak that can be made to get the IP only as well as the hits to the left?
Thanks for any help!
I'm looking to refine the following one liner to extract IP addresses, sort and rank them.
I've got so far but need to get rid of the SRC= bit to leave the IP only.
The entry in the logs follows this (IP addresses obfuscated for privacy)
Code:
Mar 3 18:00:06 myserver kernel: [414786.179376] Firewall: *TCP_IN Blocked* IN=eth0 OUT= MAC=00:00:00:00:00:ec:00:00:00:00:00:00:00:00 SRC=xxx.xxx.xxx.xxx DST=xxx.xx.xxx.xxx LEN=44 TOS=0x00 PREC=0x00 TTL=235 ID=32940 PROTO=TCP SPT=52209 DPT=1433 WINDOW=1024 RES=0x00 SYN URGP=0
Code:
cat /var/log/messages | awk '{ print $13 }' | sort | uniq -c | sort -n
45 SRC=xxx.xxx.xxx.xxx
49 SRC=xxx.xxx.xxx.xxx
54 SRC=xxx.xxx.xxx.xxx
63 SRC=xxx.xxx.xxx.xxx
... and so on. Is there a tweak that can be made to get the IP only as well as the hits to the left?
Thanks for any help!