nginx php-fpm慢日志slowlog

nginx php-fpm日志slowlog

php-fpm日志slowlog设置可以让我们很好的看见哪些php进程速度太慢而导致的网站问题。

可以让我们方便的找到问题的所在。
vi /data1/server/php-cgi/etc/php-fpm.conf

 
; The log file for slow requests
; Default Value: not set
; Note: slowlog is mandatory if request_slowlog_timeout is set
slowlog = /data1/log/$pool.log.slow
 
; The timeout for serving a single request after which a PHP backtrace will be
; dumped to the 'slowlog' file. A value of '0s' means 'off'.
; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
; Default Value: 0
request_slowlog_timeout = 1s

必须同时设置request_slowlog_timeout 0s表示关闭,就是slowlog没有用

1s表示超过1秒的处理都会被记录。

看看具体执行慢到多少秒
/data1/server/php-cgi/var/log/php-fpm.log

[19-Apr-2013 12:40:35] WARNING: [pool www] child 29514, script ‘/xx/www/adx/tx/tm.php’ (request: “GET /tx/tm.php”) executing too slow (1.034708 sec), logging


This entry was posted in Linux, PHP and tagged , , . Bookmark the permalink.
月小升QQ 2651044202, 技术交流QQ群 178491360
首发地址:月小升博客https://java-er.com/blog/php-fpm-slowlog/
无特殊说明,文章均为月小升原创,欢迎转载,转载请注明本文地址,谢谢
您的评论是我写作的动力.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

*