Created
July 2, 2015 02:37
-
-
Save jefflab/01f592a4c4754433d65d to your computer and use it in GitHub Desktop.
This file contains 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
nginx conf that capture body for specific location: | |
``` | |
http { | |
log_format l2met 'measure#nginx.service=$request_time request_id=$http_x_request_id'; | |
log_format capturebody "request_body = $request_body"; | |
access_log logs/nginx/access.log l2met; | |
error_log logs/nginx/error.log; | |
server { | |
location /path/to/log { | |
set $xxxx $request_body; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_pass http://app_server; | |
access_log logs/nginx/access.log capturebody; | |
} | |
location / { | |
set $xxxx "NOT_LOGGED"; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_pass http://app_server; | |
} | |
} | |
} | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment