Apache Log POST Data To A Log File

by on April 17, 2008 · 7 comments· LAST UPDATED April 17, 2008

in , ,

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
OR
# 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
OR
# egrep -iw 'one|two' /var/log/apache2/error.log

Further readings:

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 7 comments… read them below or add one }

1 Shantanu Oak June 6, 2008 at 4:45 am

From where can I download the module mod_dumpio ?

Reply

2 nixCraft June 6, 2008 at 6:52 am

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

Reply

3 Rohith January 23, 2009 at 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????

Reply

4 Max July 5, 2009 at 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.

Reply

5 Ryan Blunden July 27, 2009 at 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.

Reply

6 Sachin Jain October 14, 2009 at 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.

Regards,
- Sachin Jain

Reply

7 Robert October 18, 2009 at 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.

Reply

Leave a Comment

Tagged as: , , , , , , , , , , , , , ,

Previous Faq:

Next Faq: