Skip to content Skip to sidebar Skip to footer

How to Setting Apache Request Time Log Milliseconds

Previously I had a V-Host pointing to my application, and my access log was still default from apache and didn't show the request time log.

before setting request time
before setting request time.


Make sure the Apache service is on and the application can be hit from the browser.

For your server, run the command below to check service.

# systemctl status httpd
status of apache
status of apache

You can hit the application in your browser with the format "your ip: application port", here my vmware has a local ip and my application has port 1111.

status of application
status of application


Ok after all the preparation and checking are ready, it's time for us to change the default configuration from Apache.

To take care in this case or any other case. When you are going to change a setting it is better to back up first.

Enter the apache directory and backup the original.

# cd /etc/httpd/conf
# cp httpd.conf httpd.conf.ori

After you back up, change it by editing with vi

# vi httpd.conf

<IfModule log_config_module>
#LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
#LogFormat "%h %l %u %t \"%r\" %>s %b" common

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b *%T/%D*" common
LogFormat "%{Referer}i -> %U" referrer
LogFormat "%{User-agent}i" agent

save & exit

configure file httpd
configure file httpd

After doing all the settings, it's time to apply them. Check your configuration by:

# httpd -t

After all is safe and can be applied by restarting the Apache service.

# systemctl restart httpd


After all the processes are complete, try a test by monitoring the logs and trying to hit the application in your browser. Then there will be output in the access log that is different from before setting the request time.

after setting request time
after setting request time

Bangkit Ade Saputra
Bangkit Ade Saputra Hard-working professional with experience and a proven knowledge of operating system, server architecture and system configuration.

Post a Comment for "How to Setting Apache Request Time Log Milliseconds"