php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #80428 PHP-FPM : Is there an option to suppress /ping from logs
Submitted: 2020-11-27 01:43 UTC Modified: 2022-10-28 19:56 UTC
Votes:10
Avg. Score:4.6 ± 0.7
Reproduced:9 of 9 (100.0%)
Same Version:8 (88.9%)
Same OS:3 (33.3%)
From: heavy-traffic-website at yopmail dot com Assigned: bukka (profile)
Status: Closed Package: FPM related
PHP Version: 8.0.14 OS: Debian 12
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: heavy-traffic-website at yopmail dot com
New email:
PHP Version: OS:

 

 [2020-11-27 01:43 UTC] heavy-traffic-website at yopmail dot com
Description:
------------
I have PHP-FPM, I want generate access logs but, not /ping logs when :

ping.path = /ping

I am looking for an option to disable /ping access from the logs, because I have some haproxy servers that ping and it produce quantity of logs i don't need.

May a new config entry could prevent it ?

suggestion ( ping.log = no ) [default]

$> tail /var/log/php8/mypool/access.log
- -  27/Nov/2020:02:12:50 +0100 "GET /ping" 200 - 0.241 2048 0.00%
- -  27/Nov/2020:02:12:54 +0100 "GET /ping" 200 - 0.197 2048 0.00%
- -  27/Nov/2020:02:12:57 +0100 "GET /ping" 200 - 0.238 2048 0.00%
- -  27/Nov/2020:02:12:58 +0100 "GET /ping" 200 - 0.309 2048 0.00%
- -  27/Nov/2020:02:13:01 +0100 "GET /ping" 200 - 0.258 2048 0.00%
- -  27/Nov/2020:02:13:04 +0100 "GET /ping" 200 - 0.190 2048 0.00%
- -  27/Nov/2020:02:13:04 +0100 "GET /ping" 200 - 0.166 2048 0.00%


Patches

php-fpm-ping_dontlog (last revision 2022-03-06 14:30 UTC by heavy-traffic-website at yopmail dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-11-27 02:04 UTC] heavy-traffic-website at yopmail dot com
-Type: Bug +Type: Feature/Change Request
 [2020-11-27 02:04 UTC] heavy-traffic-website at yopmail dot com
Type #bug changed to #feature
 [2020-11-27 11:16 UTC] heavy-traffic-website at yopmail dot com
for one week logs, on each PHP-FPM server, i have 278.519 useless lines:

$> grep "/ping" /var/log/php8/mypool/access.log{,.1} | wc -l
278519

Moreover I have almost 2% of logs with %C%% (user + system CPU, not tested separately) that display absurdity: 

$> grep "0.00%$" /var/log/php8/mypool/access.log{,.1} | wc -l
277059

$> grep -v "0.00%$" /var/log/php8/mypool/access.log{,.1} | wc -l
3974

$> grep -v "0.00%$" /var/log/php8/mypool/access.log{,.1}  | grep "/ping" | head
- -  19/Nov/2020:22:57:09 +0100 "GET /ping" 200 - 0.161 2048 6211.18%
- -  19/Nov/2020:22:57:44 +0100 "GET /ping" 200 - 0.170 2048 5882.35%
- -  19/Nov/2020:23:04:09 +0100 "GET /ping" 200 - 0.171 2048 5847.95%
- -  19/Nov/2020:23:06:03 +0100 "GET /ping" 200 - 0.101 2048 9900.99%
- -  19/Nov/2020:23:12:00 +0100 "GET /ping" 200 - 0.137 2048 7299.27%
- -  19/Nov/2020:23:17:27 +0100 "GET /ping" 200 - 0.130 2048 7692.31%
- -  19/Nov/2020:23:18:13 +0100 "GET /ping" 200 - 0.139 2048 7194.24%
- -  19/Nov/2020:23:19:47 +0100 "GET /ping" 200 - 0.138 2048 7246.38%
- -  19/Nov/2020:23:23:10 +0100 "GET /ping" 200 - 0.157 2048 6369.43%
- -  19/Nov/2020:23:28:55 +0100 "GET /ping" 200 - 0.215 2048 4651.16%
 [2020-11-27 11:36 UTC] nikic@php.net
Really not seeing the need for this, a `grep -v "GET /ping"` does the same in a more generic way.
 [2020-11-27 12:38 UTC] heavy-traffic-website at yopmail dot com
Pretexting is normal to generate don't wanted logs because of, shell parsing exists ?

I prefer to not have /ping logs as FPM can eliminate this entries ; it will save the resouces. And some economies from here and from there, terminates by a lot of resources, so a lot of economies. Think big, how many logs represents unwanted logs on thousands servers ? Your argument "not seen why" does it match with needs ? Let me bring few elements of response.

Apache permit full conditionnal logs :

- https://httpd.apache.org/docs/trunk/en/logs.html#conditional

Haproxy permit some conditionnal logs :

HAproxt - Options dontlog-normal / dontlognull :
- https://cbonte.github.io/haproxy-dconv/2.4/configuration.html#4.2-option%20dontlog-normal
- https://cbonte.github.io/haproxy-dconv/2.4/configuration.html#4.2-option%20dontlognull

Haproxy - Disabling logging of successful connections :
- https://cbonte.github.io/haproxy-dconv/2.4/configuration.html#chapter-8.3.3
 [2020-11-28 11:50 UTC] heavy-traffic-website at yopmail dot com
The following patch has been added/updated:

Patch Name: php-fpm-ping_dontlog
Revision:   1606564222
URL:        https://bugs.php.net/patch-display.php?bug=80428&patch=php-fpm-ping_dontlog&revision=1606564222
 [2021-02-03 10:24 UTC] erik dot mueller at power dot cloud
For me and I think for everyone else who is working with PHP in a container environment like Docker this change is very important. In my specific use case I have a healthcheck set up for checking the availability of the php-fpm endpoint in a php-fpm + nginx image. So my healthcheck looks like 

#!/bin/sh

export SCRIPT_NAME=/ping
export SCRIPT_FILENAME=/ping
export REQUEST_METHOD=GET

if ! cgi-fcgi -bind -connect localhost:9000; then
	exit 1
fi

This script gets executed every 10 seconds and so my container logs get filled up with messages like

127.0.0.1 -  03/Feb/2021:10:12:01 +0000 "GET /ping" 200

I wouldn't bother about it if I would not rely on the container logs inside my infrastructure logging system. My logs and their size get bigger and bigger just because of a log that is actually not relevant for me because Docker would take action if the healthcheck is failing. So having a option to disable logging requests to the ping endpoint would be a big step ins saving space and effort getting rid of these entries inside the logs. And I think this option would also come in handy for many other people like DevOps (like me) and SysAdmins.
 [2022-02-27 08:34 UTC] heavy-traffic-website at yopmail dot com
nikic@php.net > The patch has been given. Could you understand the need ?

Anybody from PHP Team can take this improvement seriously ?

We can discuss, however, this is a need from many of us, SysAdmins.

Our file logs are too bigger, useless to expanse logs for that purpose.
 [2022-02-27 08:43 UTC] heavy-traffic-website at yopmail dot com
-Operating System: Debian 11 +Operating System: Debian 12 -PHP Version: 8.0.0 +PHP Version: 8.0.14
 [2022-02-27 08:43 UTC] heavy-traffic-website at yopmail dot com
Description:
------------
I have PHP-FPM, I want generate access logs but, not /ping logs when :

ping.path = /ping

I am looking for an option to disable /ping access from the logs, because I have some haproxy servers that ping and it produce quantity of logs i don't need.

May a new config entry could prevent it ?

suggestion ( ping.log = no ) [default]

$> tail /var/log/php8/mypool/access.log
- -  27/Nov/2020:02:12:50 +0100 "GET /ping" 200 - 0.241 2048 0.00%
- -  27/Nov/2020:02:12:54 +0100 "GET /ping" 200 - 0.197 2048 0.00%
- -  27/Nov/2020:02:12:57 +0100 "GET /ping" 200 - 0.238 2048 0.00%
- -  27/Nov/2020:02:12:58 +0100 "GET /ping" 200 - 0.309 2048 0.00%
- -  27/Nov/2020:02:13:01 +0100 "GET /ping" 200 - 0.258 2048 0.00%
- -  27/Nov/2020:02:13:04 +0100 "GET /ping" 200 - 0.190 2048 0.00%
- -  27/Nov/2020:02:13:04 +0100 "GET /ping" 200 - 0.166 2048 0.00%
 [2022-03-06 14:30 UTC] heavy-traffic-website at yopmail dot com
The following patch has been added/updated:

Patch Name: php-fpm-ping_dontlog
Revision:   1646577007
URL:        https://bugs.php.net/patch-display.php?bug=80428&patch=php-fpm-ping_dontlog&revision=1646577007
 [2022-03-07 11:56 UTC] cmb@php.net
-Status: Open +Status: Duplicate -Assigned To: +Assigned To: cmb
 [2022-03-07 11:56 UTC] cmb@php.net
Closing as duplicate of <https://github.com/php/php-src/issues/8174>.
 [2022-03-09 21:40 UTC] bukka@php.net
-Status: Duplicate +Status: Re-Opened -Assigned To: cmb +Assigned To: bukka
 [2022-03-09 21:40 UTC] bukka@php.net
Keeping this open as it contains more info and it was first.
 [2022-03-09 21:40 UTC] bukka@php.net
-Package: *Configuration Issues +Package: FPM related
 [2022-03-09 22:13 UTC] bukka@php.net
Although after re-reading the issue and this bug, here's not that much extra info. Anyway doesn't really matter if it's open or not - I'm keeping a note of this and update it here once this is fixed.
 [2022-10-28 17:16 UTC] post-modern-php at yopmail dot com
It would be great if this could be also implemented for the `/status` page, as it may also be used to determine the liveness or readiness of php-fpm (ex: https://github.com/renatomefi/php-fpm-healthcheck )
 [2022-10-28 19:56 UTC] bukka@php.net
Looks like I forgot to close this. 

This has been implemented in https://github.com/php/php-src/commit/327bb219867b16e1161da632fba170f46692484b and will be available in PHP 8.2.

> It would be great if this could be also implemented for the `/status` page

This is possible in the implemented solution: See for example
https://github.com/php/php-src/blob/327bb219867b16e1161da632fba170f46692484b/sapi/fpm/tests/config-array.phpt#L16-L17
 [2022-10-28 19:56 UTC] bukka@php.net
-Status: Re-Opened +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 22:01:28 2024 UTC