How to Setting Apache Request Time Log Milliseconds
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.
By meticulously logging request times in milliseconds, administrators gain valuable insights into server responsiveness and identify potential bottlenecks. This data empowers them to fine-tune configurations, enhance overall system efficiency, and ensure a seamless user experience.
Integrating precise time measurements into Apache or Nginx logs is a pivotal strategy for maintaining optimal server health and responsiveness.
![]() |
before setting request time. |
Preparation
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 |
You can hit the application in your browser with the format "your ip: application port", here my vmware has a local ip 192.168.79.133 and my application has port 1111.
![]() |
Status of application |
Configure
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 |
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
Trying
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 |
Maybe that's all I can share with you guys, hopefully this article will be useful.
Thank You.
Post a Comment for "How to Setting Apache Request Time Log Milliseconds"
Post a Comment