There's no single way to run and operate an application on Kubernetes. As a general purpose and flexible containers orchestrator, different people ends up with different solutions and it's usually a trade-off between features, complexity, performances, which you balance based on your needs.
This repository doesn't aim to provide a one-fits-all solution, but offering options with pros and cons from which you can pick the one that works better to your use case and business.
For a comparison between the following approaches, please see the blog post:
PHP on Kubernetes: application logging via unix pipe
- Pro: easy.
- Con: application logs are wrapped by php-fpm and it makes parsing more complicated.
- Con: application logs are truncated to 1024 bytes and splitted into multiple messages. Long logs are not unusual if you use structured logging and you log contextual information on errors (ie. stack trace).
- Con: application logs are mixed with php-fpm logs into the same stream.
See a working example at app-log-php-fpm-via-catch-workers-output/
.
See a working example at app-log-php-fpm-via-unix-pipe/
.
- Pro: application logs are not wrapped by php-fpm.
- Pro: application logs are not limited by length (no splitting / truncating).
- Pro: application logs and php-fpm error logs are not mixed together in the same stream.