Home>Article>Operation and Maintenance> How to implement apache to record request response time log

How to implement apache to record request response time log

王林
王林 forward
2020-12-14 16:38:52 4785browse

How to implement apache to record request response time log

The specific steps are as follows:

(Related recommendations:apache tutorial)

Find the apache configuration file

netstat -nap | grep 80 # 找到对应端口进程 31114 tcp6 0 0 :::4430 :::* LISTEN 31114/httpd ps auxf | grep 31114 # 找到对应apache的进程命令中的配置文件*.conf的路径,到指定路径修改配置文件,例如 vim httpd.conf

Modify the VirtualHost under the specified port

 ....... CustomLog "/var/prof.log" "[%a]%{%F %T}t id=%{APIIndex}i time=%D(us) url=%U%q"  指令: CustomLog "/var/prof.log" "[%a]%{%F %T}t id=%{APIIndex}i time=%D(us) url=%U%q"

%D - Official explanation: Time taken to process the request, in millis, the time taken to process the request, in microseconds
%T - Official Explanation: Time taken to process the request, in seconds, time taken to process the request, in seconds
%{ms}T - Official explanation: Time taken to commit the response, in millis, time taken to submit the response, in milliseconds Restart apache after modifying the unit

, and observe the log output data as follows:

[200.200.222.95]2019-03-04 15:39:32 id=- time=100107(us) url=/apps/secvisual/home/home/on_dev_manage [200.200.222.95]2019-03-04 15:39:38 id=- time=106476(us) url=/apps/secvisual/home/home/on_dev_manage [200.200.222.95]2019-03-04 15:39:43 id=- time=101263(us) url=/apps/secvisual/home/home/on_dev_manage [200.200.222.95]2019-03-04 15:39:48 id=- time=101333(us) url=/apps/secvisual/home/home/on_dev_manage

The above is the detailed content of How to implement apache to record request response time log. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete