How to Disable Logging for a Kubernetes Pod
Blog post from New Relic
Log data is essential for troubleshooting in complex platforms like Kubernetes, and New Relic provides a Fluent Bit output plugin that can be deployed as a Helm chart to collect cluster log data. A customer inquired about disabling certain logs, such as NGINX access logs and Node.js logs, to optimize costs and avoid unnecessary data collection. Two strategies were discussed for managing which logs Fluent Bit should collect: editing the parser configuration or using Kubernetes annotations. The first strategy involves modifying the parser configuration, which centralizes changes but can complicate management if new pods or logs are needed. The second strategy, using Kubernetes annotations, offers more flexibility by allowing developers to control logging on a per-pod basis, requiring the enabling of the K8S-Logging.Exclude feature in Fluent Bit. The blog suggests that annotations provide a better solution by decentralizing log configuration, thus accommodating dynamic changes in a Kubernetes environment.