Last active
August 29, 2015 14:23
-
-
Save qzchenwl/86764c6e91e3e78d0a3c to your computer and use it in GitHub Desktop.
Filter HTTP request log by IP. Redirect log to file named with IP.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
awk 'BEGIN{RS="\\+\\+\\+\\+\\+\\+\\+\\+\\+ Incoming Request \\+\\+\\+\\+\\+\\+\\+\\+\\+"; FS="\n"} { match($0, /X-Real-IP: ([0-9\.]+)/, ary); fn=ary[1]".txt"; print $0 >> fn }' debug.log | |
grep -l 'HTTP/1.1 412 Precondition Failed' *.txt | while read file; do mv $file 412; done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment