I want to log POST data in NGINX and am using $request_body to do the same.
But there are POST fields that I don’t want to log (like password, email etc). Is it possible to parse the post data OR asynchronously send data to a PHP/RUBY or any other script so that i can parse the POST data there ?
I achieved this by using Nginx LUA module. and then by calling
ngx.req.get_post_args()in the lua script, i was able to get the post content in the form of a table (LUA’s arrays). Hence parsing this in lua itself removing unnecessary parameters and logging it solved this issue.