Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do you log the response body (not request body) in nginx? I could not find such a variable in any of the modules (only the request body).

We are using nginx as a reverse proxy/loadbalancer and would like to parse our API requests & responses from nginx logs.

Thank you!

share|improve this question
I don't know anything like mod_security for Apache, that allows such type of logging. Maybe a 3Party Module? – grosshat May 22 '12 at 12:56 might answer the question. – kojo Nov 7 '13 at 10:38

You could log the headers using $upstream_http_HEADER. Doesn't seem like there is a variable for the response body though but I'm not surprised - this part would be optimized.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.