Skip to content

Instantly share code, notes, and snippets.

@brucewoodward
Created February 27, 2017 05:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brucewoodward/210f3765f95200e0691f946e4fc3a697 to your computer and use it in GitHub Desktop.
Save brucewoodward/210f3765f95200e0691f946e4fc3a697 to your computer and use it in GitHub Desktop.
Show who has been accessing your rails app
#!/bin/sh
# Install geoiplookup
# Remove the reference to the IP address 69.162.124.237 to play.
grep `date '+%Y-%m-%d'` production.log | grep Started | grep -v 69.162.124.237 | awk '{print $10, $12}' | while read path ip
do
echo `echo $path | sed 's/"//g'` $ip `geoiplookup $ip | awk -F: '{print $NF}'` `nslookup $ip | awk '/arpa/ {print $NF}'`
done | sort -u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment