[php-src] Issue #9010: php-fpm log_limit not compatible with AWS cloudwatch
| From: | sylvain-spryker | Date: | Thu, 14 Jul 2022 09:36:32 +0000 |
| Subject: | [php-src] Issue #9010: php-fpm log_limit not compatible with AWS cloudwatch | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-241927@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9010
Author: sylvain-spryker
### Description
The following code:
https://github.com/php/php-src/blob/da523060fbca5141aeb3dea2cd6dcead4a690970/sapi/fpm/fpm/zlog.c#L243
Resulted in this output:
Cloudwatch shows 1 line per 1024 char of error logs
But I expected this output instead:
each line in cloudwatch should be with the entire log message, no cuts.
---
Hi lovely people,
A bit of context here, I am not sure this is a bug or intended. And I could not really find an
explication for this behavior, so please forgive me if i open this in the wrong place.
We use AWS to deploy our php containers, and cloudwatch to gather the error logs sent by the
application.
We noticed that the logs were cut with a new line every 1024 character. In cloudwatch that means a
new log entry. The result is completely unusable logs, because when you make a search, you will
endup with a partial log line.
In addition to this we use Json output for easier processing... you can imagine the result.
I was able to pinpoint the issue to php-fpm workers configuration. However I was expecting to be
able to set it to 0 (no limit) and I got the message saying that log_limit cannot be less than 512
characters. ([see
here](https://github.com/php/php-src/blob/ffcf57fa187f55b6e2cf3e6de43b03332cc750de/sapi/fpm/fpm/zlog.h#L118))
I could set the number to be very high as I do not see an upper bound, but I was wondering if maybe
there was a better solution.
Do you guys have a context as to why this limit was put in place? (I checked the git messages but
could not get any information beside "refactoring logs" )
@bukka I believe you were responsible for this feature. Maybe you would have some input?
Thanks for your work guys and any advice is much appreciated.
Best,
S.
### PHP Version
> 7.3
### Operating System
_No response_