Log POST data in Apache

By | 2013/02/08

Apache can log all POST data for troubleshooting purposes. I’ll show you how to set this up!


First you will need to enabled mod_dumpio.

On Ubuntu / Debian enable the module:

$ sudo a2enmod dump_io

Then add the following and restart apache:

$ sudo nano /etc/apache2/apache2.conf
LogLevel debug
DumpIOInput On
DumpIOOutput On
DumpIOLogLevel debug # optional - Apache 2.2.4 or later only

Red Hat / CentOS:

$ sudo nano /etc/httpd/conf/httpd.conf

Add the following:

LoadModule dumpio_module modules/mod_dumpio.so

LogLevel debug
DumpIOInput On
DumpIOOutput On
DumpIOLogLevel debug # optional - Apache 2.2.4 or later only

The POST data is then logged to the error_log for Apache. /var/log/httpd/error_log (Red Hat) or /var/log/apache2/error.log (Debian).

Be careful as logs will grow to be very huge in size! Only use this to debug special case scenarios.

4 thoughts on “Log POST data in Apache

  1. Oki

    The apache won’t start after adding these lines to apache2.conf:
    LogLevel debug
    DumpIOInput On
    DumpIOOutput On
    DumpIOLogLevel debug

    If I remove them, the apache would be back to work. And the POST data still not recorded.

    Reply
  2. Tim

    On Centos 6 Apache starts and loads DumpIO but nothing is appeared in error_log

    Reply
  3. Tim

    Found!

    The problem was apparently that just one of my VirtualHosts (as defined in /etc/apache2/sites-enabled) had a LogLevel declared that was something other than debug, thus interfering with the overall behavior of mod_dumpio for reasons that escape me 🙂

    I hope someone else finds this helpful.

    Reply
  4. unknown

    This conf doesn’t work for me.
    Works with:
    LogLevel dumpio:trace7

    Debian 8

    Reply

Leave a Reply

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

Notify me of followup comments via e-mail. You can also subscribe without commenting.