Troubleshooting Fluentd
The following sections help you troubleshoot the Fluentd statefulset component of the Logging operator.
Check Fluentd pod status (statefulset)
Verify that the Fluentd statefulset is available using the following command: kubectl get statefulsets
Expected output:
ConfigCheck
The Logging operator has a builtin mechanism that validates the generated fluentd configuration before applying it to fluentd. You should be able to see the configcheck pod and its log output. The result of the check is written into the status
field of the corresponding Logging
resource.
In case the operator is stuck in an error state caused by a failed configcheck, restore the previous configuration by modifying or removing the invalid resources to the point where the configcheck pod is finally able to complete successfully.
Check Fluentd configuration
Use the following command to display the configuration of Fluentd:
kubectl get secret logging-demo-fluentd-app -o jsonpath="{.data['fluentd\.conf']}" | base64 --decode
The output should be similar to the following:
Set Fluentd log Level
Use the following command to change the log level of Fluentd.
kubectl edit loggings.logging.banzaicloud.io logging-demo
Get Fluentd logs
The following command displays the logs of the Fluentd container.
Fluentd logs were written to the container filesystem up until Logging operator version 4.3, which has been changed to stdout with 4.4. See FluentOutLogrotate why this was changed and how you can re-enable it if needed.
Tip: If the logs include the
error="can't create buffer file ...
error message, Fluentd can’t create the buffer file at the specified location. This can mean for example that the disk is full, the filesystem is read-only, or some other permission error. Check the buffer-related settings of your Fluentd configuration.
Set stdout as an output
You can use an stdout filter at any point in the flow to dump the log messages to the stdout of the Fluentd container. For example:
kubectl edit loggings.logging.banzaicloud.io logging-demo
Check the buffer path in the fluentd container
kubectl exec -it logging-demo-fluentd-0 ls /buffers
Getting Support
If you encounter any problems that the documentation does not address, file an issue or talk to us on Discord or on the CNCF Slack.
Before asking for help, prepare the following information to make troubleshooting faster:
- Logging operator version
- kubernetes version
- helm/chart version (if you installed the Logging operator with helm)
- Logging operator logs
- fluentd configuration
- fluentd logs
- fluentbit configuration
- fluentbit logs
Do not forget to remove any sensitive information (for example, passwords and private keys) before sharing.