5

Is it possible to adjust Apache config somehow to log POST / GET parameters?

For example, this is what it currently logs:

174.131.xx.xxx - - [30/Apr/2013:08:41:59 -0500] "POST /admin/bl_orderItem.php HTTP/1.1" 200 44

I would like to achiev something like this to be seen in logs:

174.131.xx.xxx - - [30/Apr/2013:08:41:59 -0500] "POST /admin/bl_orderItem.php?name=John&lastName=Rambo&zip=12331 HTTP/1.1" 200 44

Thank you for all suggestions.

3 Answers 3

7

In a custom log format %r (first line of request) will contain the GET parameters. For just the GET params use %q (query string (prepended with a ? if a query string exists, otherwise an empty string)).

See http://httpd.apache.org/docs/2.4/mod/mod_log_config.html#formats

For the post data you have to use mod_dumpio.

See http://httpd.apache.org/docs/2.4/mod/mod_dumpio.html

1

You also might want to look at mod_security module to do this. It's really great at logging all params (in and out).

-1

you may use php:

https://stackoverflow.com/questions/3718307/php-script-to-log-the-raw-data-of-post

<?php
file_put_contents("post.log",print_r($_POST,true));
?>
2
  • 1
    The question is about get the data in apache log, not in a PHP script. Better to delete this answer
    – shakaran
    Dec 1, 2016 at 3:07
  • 1
    I think it's a great "think outside the box" type of answer. Simple, too, if you've already got php installed. Oct 24, 2017 at 5:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.