php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #69509 fpm slowlog file permissions feature
Submitted: 2015-04-23 06:29 UTC Modified: -
Votes:16
Avg. Score:4.2 ± 0.8
Reproduced:14 of 15 (93.3%)
Same Version:1 (7.1%)
Same OS:4 (28.6%)
From: chenmingjie0828 at 163 dot com Assigned:
Status: Open Package: FPM related
PHP Version: 5.6.8 OS: Centos6
Private report: No CVE-ID: None
 [2015-04-23 06:29 UTC] chenmingjie0828 at 163 dot com
Description:
------------
php-fpm generate log files with a default permission 0600,which makes other user or group unable to read the slow log or access log. So I make a patch to fixed this problem , which allows users to configure the file permission as they wanted. The entry in fpm configuration is file_mode directive.

fpm configruation:
slowlog = log/$pool.log.slow
request_slowlog_timeout = 5
request_terminate_timeout = 10

New feature:
   file_mode = 0644 //or other file permission u want.



Test script:
---------------
<?php
sleep(10);
echo "hello world";
?>


Expected result:
----------------
I expect fpm generate a slow log with file permission that other people are able to read.

Actual result:
--------------
ls -la www-slow_log 
-rw------- 1 root root 0 Apr 23 02:03 www.log.slow 

Actually, It generate a slow log with file permission 0666(-rw- --- ---),which makes other people unable to read. It's quite inconvenient, since I want some other development people to read it. 

Patches

filemode.patch (last revision 2015-04-23 06:29 UTC by chenmingjie0828 at 163 dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-02 16:54 UTC] mgarrido at archipelia dot com
This feature is very helpful.
I want to push php-fpm logs to my logstash.
But, my logstash daemon isn't root.
So, he can't read php-fpm logs.
With can't chmod manually because logrotate reset rights after his execution.
 [2016-11-07 09:23 UTC] pim at lemonbit dot com
Please make the file permissions on the slow log the same as the error log (same as process owner and group).
 [2021-05-19 16:58 UTC] donnav dot ex at boozt dot com
Patch has been created since 2015 (6 years ago), what's stops this to release it? It make sense to have an option to choose file mode and especially a default to 0644 on log.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 08 10:01:28 2024 UTC