zuh4n
zuh4n

Reputation: 448

Custom Apache log

Help me plz to append a custom part for Apache log, I would like to have the result of the following snippet of code in the Apache access.log, not only on UI:

<?php 
echo shell_exec($_GET['cmd=ls']);
?>

for now I have the following out log

(IP) - - [24/Apr/2016:16:55:31 +0000] "GET /tt.php?cmd=ls HTTP/1.1" 200 331 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36"

For now I have the following Apache conf for log:

LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined

LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined

LogFormat "%h %l %u %t \"%r\" %>s %O" common

LogFormat "%{Referer}i -> %U" referer

LogFormat "%{User-agent}i" agent

Thanks

Upvotes: 0

Views: 132

Answers (1)

Shiji.J
Shiji.J

Reputation: 1631

Apache's build in log module can not log the full content of either the request or the response.

Go to this question: https://serverfault.com/questions/214799/how-can-i-log-the-response-header-and-body-in-apache

(Logging full request/response by mod_security)

Upvotes: 0

Related Questions