How can I log the response header and body in apache?

You can do this via mod_security, see the Documentation about Audit Log data format.


in case you do not get any response body in your logs when using "Intended Response Body (E)"; eg.:

SecAuditLogParts ABCEFHZ

Make sure you also have activated the rule engine:

SecRuleEngine On

and check your settings for:

SecRequestBodyAccess On
SecResponseBodyAccess On