Skip to content

Instantly share code, notes, and snippets.

@aabril
Created February 10, 2012 11:54
Show Gist options
  • Save aabril/1789037 to your computer and use it in GitHub Desktop.
Save aabril/1789037 to your computer and use it in GitHub Desktop.
see clients ip's from a nginx log
# input:
# 2012/02/10 09:32:36 [error] 17798#0: *30890 open() "/var/www/media/icon.png" failed (2: No such file or directory),
# client: 10.10.100.100, server: dev.myserver.com, request: "GET /media/icon.png HTTP/1.1", host: "dev.myserver.com",
# referrer: "http://dev.myserver.com/index"
#
# output
# client: 10.10.100.100
cat error.log | grep client | awk 'BEGIN {FS="client: "}{print "client: "$2}' | cut -d "," -f 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment