Apache access log provides many useful parameters which are very helpful while debugging. Requester IP, request url, user agent, request response code, request response size, request creation time etc but if you want to know the execution time of each request, there is nothing wrong with this requirement.
To achieve this, you need to make modifications in LogFormat attribute of apache configuration file.
You can find this parameter in apache configuration file of RPM based distributions like CentOS as well as Debian based distributions like Ubuntu.
You need to add %T or %D parameters in the LogFormat of apache configuration file. Search following line
%T shows the response time in Seconds and %D shows the response time in microseconds. %D is very useful for short time response or to find exact value of response.
Suppose any request takes 7 seconds to finish, you can find its microseconds value in access log something like 7458962 or 7896547.
You can find apache configuration file in /etc/apache2/apache2.conf or /etc/httpd/conf/httpd.conf. Similarly you can find access log file in /var/log/apache2/access.log or /var/log/httpd/access_log
To achieve this, you need to make modifications in LogFormat attribute of apache configuration file.
You can find this parameter in apache configuration file of RPM based distributions like CentOS as well as Debian based distributions like Ubuntu.
You need to add %T or %D parameters in the LogFormat of apache configuration file. Search following line
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
and change intoLogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\" **%T/%D**" combined
We have just added %T and %D in value of the attribute.
%T shows the response time in Seconds and %D shows the response time in microseconds. %D is very useful for short time response or to find exact value of response.
Suppose any request takes 7 seconds to finish, you can find its microseconds value in access log something like 7458962 or 7896547.
You can find apache configuration file in /etc/apache2/apache2.conf or /etc/httpd/conf/httpd.conf. Similarly you can find access log file in /var/log/apache2/access.log or /var/log/httpd/access_log