Log -php-fpm slow query log

Disclaimer: This article is a blogger original article, reproduced, please indicate the source. https://blog.csdn.net/ty_hf/article/details/55504172
project with php development, in the course of a production run, it should be under surveillance for some time php scripts running, which php process is too slow, what are the error log .
Q: How to see detected relatively slow php script it?
A: Check php-fpm slow logs.

1. First find the configuration file stored address
find / -name php-fpm.conf


we /usr/servers/php/etc/php-fpm.conf


Open look you slow logging is turned on, or slow the log open to be located.
Corresponding addresses can be replaced with your own.

2. If you do not turn on slow query log, first open

The default is 0 request_slowlog_timeout, slow php script log is off, and therefore n is greater than 0 is set, the execution time of the script recording exceeds n slowlog enter inside.
Then monitor the presence of a problem when viewing the site can be found at slowlog slow script, the script can check processing.

request_slowlog_timeout and slowlog need to set up,
at the same time open request_slowlog_timeout the need to open slowlog,
slow need to manually create the log path

Remove request_slowlog_timeout, slowlog prefix semicolon ';'
set = 1 request_slowlog_timeout;
: // WQ save and exit slow to create the log directory
mkdir -p /var/logdata/php-fpm/php-fpm-slowlog.log
killall PHP-FPM / usr / servers / php / sbin / php-fpm // restart php-fpm


3. Locate the slow log storage address

4. Observation slow log

tailf /var/logdata/php-fpm/php-fpm-slowlog.log

When turned on, if there are more than a specified script execution time will be written like the following in the specified log file:
[. 19-On Dec-2016 16:54:49] [the pool WWW] 18575 PID
SCRIPT_FILENAME = / Home / Web / the htdocs / sandbox_canglong / Test / tt.php
[0x0000000003a00dc8] the curl_exec () /home/web/htdocs/sandbox_canglong/test/tt.php:2
[0x0000000003a00cd0] exfilter_curl_get () / Home / Web / the htdocs / sandbox_canglong / Test / tt.php: 6


Log Description:
SCRIPT_FILENAME entrance file
curl_exec (): it's time to execute the method of execution over time.
exfilter_curl_get (): Description method call curl_exec () is exfilter_curl_get ().
The end of each line number is the line number of the colon.


When turned on, the error log file is also relevant records. As follows:
[. 19-On Dec-2016 15:55:37] the WARNING: [the pool WWW] Child 18575, Script '/home/web/htdocs/sandbox_canglong/test/tt.php' (Request: "the GET / Test / TT. PHP ") Executing TOO SLOW (1.006222 sec), the logging
[. 19-On Dec-2016 15:55:37] NOTICE: 18575 Child stopped for Tracing
[. 19-On Dec-2016 15:55:37] NOTICE: About 18575 to the trace
[ 19-Dec-2016 15:55:37] NOTICE : finished trace of 18575


System Log: Record information about the system: HTTP: //blog.csdn.net/ty_hf/article/details/55511624
the Apache access log and error log: HTTP: //blog.csdn.net/ty_hf/article/details/55504719
nginx access log and error log: HTTP: //blog.csdn.net/ty_hf/article/details/55518070
PHP-FPM slow log: perform a slow PHP script: http: //blog.csdn.net/ty_hf/article / the Details / 55,504,172
php error log: php detection operation or user log errors: HTTP: //blog.csdn.net/ty_hf/article/details/55505262
mysql slow log: mysql server records affect the performance of SQL: http : //blog.csdn.net/ty_hf/article/details/55504172

This article addresses: http: //blog.csdn.net/ty_hf/article/details/55504172

--------------------- 
Author: sometimes quiet 
Source: CSDN 
Original: https: //blog.csdn.net/ty_hf/article/details/55504172 
Copyright: This article is a blogger original article, reproduced, please attach Bowen link!

Guess you like

Origin blog.csdn.net/gb4215287/article/details/90698448