Best way to log POST data in Apache?
Use Apache's mod_dumpio. Be careful for obvious reasons.
Note that mod_dumpio stops logging binary payloads at the first null character. For example a multipart/form-data
upload of a gzip'd file will probably only show the first few bytes with mod_dumpio.
Also note that Apache might not mention this module in httpd.conf
even when it's present in the /modules
folder. Just manually adding LoadModule
will work fine.
You can install mod_security
and put in /etc/modsecurity/modsecurity.conf
:
SecRuleEngine OnSecAuditEngine OnSecAuditLog /var/log/apache2/modsec_audit.logSecRequestBodyAccess onSecAuditLogParts ABIJDFHZ