默认情况下docker不允许使用SYS_PTRACE调用,而php-fpm的慢日志依赖该方法。
docker 可以添加--cap-add=SYS_PTRACE
解决
k8s配置如下内容解决:
securityContext:
capabilities:
add: ["SYS_PTRACE"]
capabilities:
add: ["SYS_PTRACE"]
最终效果如:
root@test-55d8577469-zh4rq:/data/logs# cat fpm-slow.log
[17-Oct-2023 15:16:34] [pool www] pid 163
script_filename = /data/htdocs/default/public/slow.php
[0x00007f5ab2a150f0] sleep() /data/htdocs/default/public/slow.php:8
[0x00007f5ab2a150a0] testFunc() /data/htdocs/default/public/slow.php:19
[17-Oct-2023 15:16:34] [pool www] pid 163
script_filename = /data/htdocs/default/public/slow.php
[0x00007f5ab2a150f0] sleep() /data/htdocs/default/public/slow.php:8
[0x00007f5ab2a150a0] testFunc() /data/htdocs/default/public/slow.php:19
https://serverfault.com/questions/890768/php-slowlog-empty-even-though-php-fpm-says-its-logging
当前还没有任何评论