Created
February 9, 2016 07:46
-
-
Save topolik/92769c7bad2782e0419d to your computer and use it in GitHub Desktop.
sed filter for apache/nginx access log
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
#!/bin/bash | |
# | |
# 10.0.0.111 - - [01/Feb/2016:04:44:11 -0800] "GET /o/js_bundle_config?t=29 HTTP/1.1" 200 30370 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36" | |
# | |
# sed 's/\(.\+\) \(\[.\+\]\) \(".\+"\).* \([0-9]\+\) \([0-9\-]\+\) \(".\+"\) \(".\+"\)//' | |
# | |
# backreferences: | |
# \1 ... IP + client + user | |
# \2 ... date+time | |
# \3 ... request line | |
# \4 ... HTTP status | |
# \5 ... response size | |
# \6 ... referer header | |
# \7 ... user agent | |
sed 's/\(.\+\) \(\[.\+\]\) \(".\+"\).* \([0-9]\+\) \([0-9\-]\+\) \(".\+"\) \(".\+"\)/\7/' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment