Apache Cheatsheet

Log Responses

Install the dump_io mod by running this as root:

a2enmod dump_io

Add these lines to the bottom of the /etc/apache2/apache2.conf file:

LogLevel dumpio:trace7
DumpIOInput On
DumpIOOutput On

Restart the apache service to enact the changes:

service apache2 restart

View response data with this command:

cat error.log | cut -f8- -d':' | egrep -v ' [0-9]+ bytes$' | grep -v '^$' | cut -c2- | sed 's/\\r\\n//'

Run as an infinite loop:

while true; do cat error.log | cut -f8- -d':' | egrep -v ' [0-9]+ bytes$' | grep -v '^$' | cut -c2- | sed 's/\\r\\n//'; sleep 5; done

Resources:
https://httpd.apache.org/docs/2.4/mod/mod_dumpio.html
https://serverfault.com/questions/445720/i-cant-get-the-dump-io-module-working