Skip to content

Instantly share code, notes, and snippets.

@karmanyaahm
Last active January 7, 2021 16:31
Show Gist options
  • Save karmanyaahm/f920115dc05ee69c264cd7f90440c0d2 to your computer and use it in GitHub Desktop.
Save karmanyaahm/f920115dc05ee69c264cd7f90440c0d2 to your computer and use it in GitHub Desktop.
ip address info from nginx logs or any similar logs
cat access.log access.log.1 | grep '/t.json' | awk '{print $1}' | sort | uniq | xargs -L1 -I % curl "https://freegeoip.app/json/%" | tee -a ~/log.log
cat access.log access.log.1 | grep '/t.json' | awk '{print $1}' | sort | uniq -c | sort|awk '{printf("%d ", $1); system("curl https://freegeoip.app/json/" $2)}'|tee -a ~/log2.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment