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

How to implement apache to record request response time log

王林
Release: 2020-12-14 16:38:52
forward
5046 people have browsed it

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
Copy after login

Modify the VirtualHost under the specified port

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

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

%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
Copy after login

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!

Related labels:
source:csdn.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template