Skip to content

Instantly share code, notes, and snippets.

@atripes
Last active February 28, 2018 16:32
Show Gist options
  • Save atripes/5c43c30299253ef04c2a1db59431624e to your computer and use it in GitHub Desktop.
Save atripes/5c43c30299253ef04c2a1db59431624e to your computer and use it in GitHub Desktop.
nginx logging depending on upstream server
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