≡ Menu

Apache Log POST Data To A Log File

Q. How do I log POST data submitted by our user registration form to a log file under Debian Linux Apache 2 Web Server?

A. You can use mod_security or mod_dumpio module under Apache web server to dump POST data.

Apache mod_dumpio Module

This module allows for the logging of all input received by Apache and/or all output sent by Apache to be logged / dumped to the error.log file.

WARNING! These examples requires apache version 2.1.3 or above along with mod_dumpio

Step # 1: Enable mod_dumpio module

Type the following command as the root user:
$ sudo a2enmod dump_io
# a2enmod dump_io
Restart Apache Web server:
# /etc/init.d/apache2 force-reload

Step # 2: Configuration

Open httpd.conf or apache2.conf file:
# vi apache2.conf
Enable dumping of all input data:
DumpIOInput On
Enable dumping of all output at a specific LogLevel level such as notice or debug:
DumpIOLogLevel debug
If you want to enable dumping of all output, enter:
DumpIOOutput On
Save and close the file. Just restart Apache2:
# /etc/init.d/apache2 restart

How do I view logs?

All data is logged to error log file,
# tail -f /var/log/apache2/error.log
# egrep -iw 'one|two' /var/log/apache2/error.log

Further readings:

{ 8 comments… add one }

  • Shantanu Oak June 6, 2008, 4:45 am

    From where can I download the module mod_dumpio ?

  • nixCraft June 6, 2008, 6:52 am

    Apache website or search any rpm / debian repo for a package. It is part of many distro.

  • Rohith January 23, 2009, 6:31 am

    Thankyou for the information. I would be very greatful if you could help me. My problem is
    ‘ i want to configure my apache server to get the response time of the server. for that which file should i edit? HOW????

  • Max July 5, 2009, 11:06 pm

    An alternative to mod_dumpio would be mod_log_post, also doing a well job for me. It works with any Apache 2.x version, thus not dependent on Apache 2.1.3 or later.

  • Ryan Blunden July 27, 2009, 3:01 am

    I’ve enabled this but I’ve setup custom error logs for all my websites. I’ve looked in both the access and error logs and the dumping of post variables is nowhere to be seen.

  • Sachin Jain October 14, 2009, 3:45 pm

    Hello Max,

    I am trying to log POST request data into log files. I am working on Windows XP. Can you tell me if mod_log_post is available for windows?

    Thanks for your help.

    – Sachin Jain

  • Robert October 18, 2009, 3:36 pm

    If somebody really helps me, I could imagine to build and maintain my mod_log_post module for Windows systems. So if you’ve too much free time and real build experience with Windows systems and especially Apache modules, simply contact the mod_log_post upstream.

  • Ivy Joy Aguila July 30, 2015, 10:34 am

    please note that on Apache 2.4
    “mod_dumpio: DumpIOLogLevel is no longer supported. Data is always logged at LogLevel trace7.” this is from
    Thanks :)

Leave a Comment

   Tagged with: , , , , , , , , , , , , , ,