Last active
February 28, 2018 16:32
-
-
Save atripes/5c43c30299253ef04c2a1db59431624e to your computer and use it in GitHub Desktop.
nginx logging depending on upstream server
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
upstream { | |
server 10.0.0.200; | |
server 10.0.0.300; | |
} | |
map $upstream_addr $should_log { | |
"10.0.0.200:80" 1; | |
default 0; | |
} | |
server { | |
... | |
access_log /var/log/nginx/single_upstream_host.log if=$should_log; | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment