Collect PHP-related logs using Logstash

Source: Internet
Author: User
Tags apc php error php error log zts logstash

Collect three kinds of logs here

PHP error log, php-fpm error log and slow query log


Set in php.ini

Error_log =/data/app_data/php/logs/php_errors.log


Set in php-fpm.conf

Error_log =/data/app_data/php/logs/php-fpm_error.log

Slowlog =/data/app_data/php/logs/php-fpm_slow.log


The PHP error log is as follows:

[29-jan-2015 07:37:44 utc] php warning:  php startup: unable to  load dynamic library  '/data/app_platform/php/lib/php/extensions/no-debug-non-zts-20100525 /redis.so '  - /data/app_platform/php/lib/php/extensions/no-debug-non-zts-20100525/redis.so:  Cannot open shared object file: no such file or directory in  Unknown on line 0[29-Jan-2015 07:37:44 UTC] PHP Warning:   php startup: unable to load dynamic library  '/data/app_platform/php/lib/php /extensions/no-debug-non-zts-20100525/apc.so '  - /data/app_platform/php/lib/php/extensions/ No-debug-non-zts-20100525/apc.so: cannot open shared object file: no such  file or directory in unknown on line 0[29-jan-2015 07:37:44  utc] php warning:  php startup: unable to load dynamic library  '/data/app_platform/ Php/lib/php/extensions/no-debug-non-zts-20100525/mongo.so '  - /data/app_platform/php/lib/php/ extensions/no-debug-non-zts-20100525/mongo.so: cannot open shared object file:  No such file or directory in unknown on line 0


The PHP-FPM error log is as follows:

[30-jan-2015 10:32:25] error: unable to read what child say: bad  file descriptor  (9) [30-jan-2015 10:32:25] error: unable to read  what child say: bad file descriptor  (9) [30-jan-2015 10:32:25] error:  unable to read what child say: Bad file descriptor  (9) [30- Jan-2015 10:32:25] error: unable to read what child say: bad  file descriptor  (9) [30-jan-2015 10:32:25] error: unable to read  what child say: bad file descriptor  (9) [10-mar-2015 17:37:11] error:  unable to read what child say: Bad file descriptor  (9) [10- Mar-2015 17:37:11] error: unable to read what child say: bad  file descriptor  (9) [10-mar-2015 21:31:48] error: unable to read what child say:  Bad file descriptor  (9)


The slow query log for PHP-FPM is as follows:

[11-mar-2015 16:54:17]  [pool www] pid 12873script_filename = /data// Index.php[0x00007f497fa5b620] curl_exec ()  /data//account.php:221[0x00007f497fa5a4e0] call ()  /data/gintama_app/jidong/game_code/app/controllers/game.php:31[0x00007fff29eea180] load ()   Unknown:0[0x00007f497fa59e18] call_user_func_array ()  /data/library/basectrl.php:20[ 0x00007fff29eea470] handoutaction ()  unknown:0[0x00007f497fa59400] run ()  /data//index.php : 30[11-mar-2015 16:56:46]  [pool www] pid 12881script_filename = /data /index.php[0x00007f497fa5b620] curl_exec ()  /data//account.php:221[0x00007f497fa5a4e0] call ()  /data/game.php:31[0x00007fff29eea180] load ()  unknown:0[0x00007f497fa59e18] call_user_func _array ()  /data/library/basectrl.php:20[0x00007fff29eea470] handoutaction ()  unknown:0[ 0x00007f497fa59400] run ()  /data/index.php: 30 






This article is from the Linux SA John blog, so be sure to keep this source http://john88wang.blog.51cto.com/2165294/1641723

Collect PHP-related logs using Logstash

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.