Last active
December 24, 2015 07:29
-
-
Save christianchristensen/6763747 to your computer and use it in GitHub Desktop.
Log additional request info into apache logs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
LogFormat "\"%r\" \"%{x-meh}o\"" test_123 | |
CustomLog ${APACHE_LOG_DIR}/access.log test_123 | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$postdata = file_get_contents("php://input"); | |
$method = "Not Available"; | |
// Match method string in body | |
$pos = stripos($postdata, 'method'); | |
if ($pos !== FALSE) { | |
$method = substr($HTTP_RAW_POST_DATA, $pos, 100); | |
} | |
header("x-meh: ${method}"); | |
// Cleanup vars | |
unset($postdata, $pos, $method); | |
// Additional info: | |
// * http://httpd.apache.org/docs/2.2/logs.html | |
// * http://httpd.apache.org/docs/2.2/mod/mod_log_config.html#formats | |
// * http://82.157.70.109/mirrorbooks/apachesecurity/0596007248/apachesc-chp-8-sect-1.html "Integration with PHP" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment