Extracting IP Addresses from a Log File with grep and sort
Find ip address in logfile.
Log files come in all kinds of formats, so you will not necessarily get the same result; treat this as a rough reference only.
This time I extract the IP addresses of my own subnet from a dnsmasq log file
The dnsmasq log Copy Jan 25 05:45:04 dnsmasq[1]: query[A] firestore.googleapis.com from 192.168.1.43 Jan 25 05:45:04 dnsmasq[1]: cached firestore.googleapis.com is 142.250.196.106 Jan 25 05:45:04 dnsmasq[1]: query[AAAA] firestore.googleapis.com from 192.168.1.43 Jan 25 05:45:04 dnsmasq[1]: cached firestore.googleapis.com is 2404:6800:4004:827::200a Jan 25 05:45:04 dnsmasq[1]: reply easylist-downloads.adblockplus.org is 65.21.35.75 Jan 25 05:45:04 dnsmasq[1]: reply easylist-downloads.adblockplus.org is 136.243.9.187 Jan 25 05:45:04 dnsmasq[1]: reply easylist-downloads.adblockplus.org is 141.95.40.123 Jan 25 05:45:04 dnsmasq[1]: reply easylist-downloads.adblockplus.org is 51.255.232.90 Jan 25 05:45:04 dnsmasq[1]: reply easylist-downloads.adblockplus.org is 95.216.77.130 Jan 25 05:45:04 dnsmasq[1]: reply easylist-downloads.adblockplus.org is 95.217.32.92 Jan 25 05:45:05 dnsmasq[1]: query[A] firestore.googleapis.com from 192.168.1.43 Jan 25 05:45:05 dnsmasq[1]: cached firestore.googleapis.com is 142.250.196.106 Jan 25 05:45:05 dnsmasq[1]: query[AAAA] firestore.googleapis.com from 192.168.1.43 - Extracting only the IP addresses From all of this, extract only the IP addresses in the form 192.168.1.*
[Read More]