If you want to log all input received and output sent by Apache to its error.log then you are on the right post. We will use "mod_dumpio" which allows us to log the input/output of Apache to its error log. Below are the steps you can follow in order to achieve the desired logging:
Enable mod_dumpio
To enable mod_dumpio module for apache using the following command:
Enable mod_dumpio
To enable mod_dumpio module for apache using the following command:
sudo a2enmod dump_io
Module configuration
Next step is to configure this module. To do this open apache's configuration file "apache2.conf":
sudo nano /etc/apache2/apache2.conf
Now add the following configuration options in the configuration file:
DumpIOInput On
DumpIOOutput On
DumpIOLogLevel debug
DumpIOInput enables Apache's input logging whereas DumpIOOutput enables it's output logging. DumpIOLogLevel specifies the level of information to be logged. You can find all levels by taking a look at this link --> http://httpd.apache.org/docs/2.2/mod/core.html#loglevel
Restart Apache
Now you need to restart apache using the following command:
sudo service apache2 restart
or
sudo /etc/init.d/apache2 restart
Now you can open up the apache error log or tail on it to see Apache input and output logs. Use the following command to tail on the log:
sudo tail -f /var/log/apache2/error.log
Note:
If for some reason you do not see apache's input/output logs in the error.log file, you may want to look at any other config file that might set apache's log level. For example in my case I had a sites enabled module in apache turned on and I had a site configured for that. The location was "/etc/apache2/sites-enabled/xyz". Where xyz may be your site name. Open this file and see if the LogLevel set in this file is different from the DumpIOLogLevel that you just specified for the dump_io module. The values should be the same or you wont see any logging.