Log POST data in nginx

How to configure nginx to log POST data in nginx?

NGINX is a powerful web server that can easily tens of thousands of  HTTP requests per second with minimum CPU consumption. Each time NGINX handles a connection, a log entry is generated to store some information this connection like remote IP address, response size and status code, etc. In some cases, you may be more interested in storing the body of requests, specifically POST requests. In this article we will explain how to enable POST data logging in nginx

We will use the $request_body log parameter to log the actual POST data of the incoming request. Nginx configuration will look like this

Restart nginx service once changes are made in config file

You will be able to see the logs here in the log


Leave a Reply

Your email address will not be published. Required fields are marked *