Fluentd Log Unreadable. It Is Excluded and Would Be Examined Next Time
When you see the message "Log unreadable. It is excluded and would be examined next time" in Fluentd, it indicates that Fluentd encountered an issue while reading a log file. This issue could arise due to various reasons, such as file permissions, format issues, or file rotation. Below are some common causes and how to troubleshoot them:
1. File Permission Issues
Fluentd might not have the necessary permissions to read the log file.
Check File Permissions: Ensure that the user running Fluentd has read permissions for the log file.
ls -l /path/to/your/log/file.log
If necessary, adjust the permissions:
chmod 644 /path/to/your/log/file.log
Or change the ownership:
chown fluentd_user:fluentd_group /path/to/your/log/file.log
2. Log File Format Issues
Fluentd might have trouble reading the file due to unexpected file format or corruption.
- Verify Log Format: Check that the log file content is in the expected format (e.g., plain text, JSON, etc.).
- Check for Corruption: Ensure that the log file is not corrupted. You can check this by manually opening and inspecting the file.
3. File Rotation Issues
Log files may be rotated (e.g., by logrotate), which can cause issues with Fluentd’s tail
plugin.
Configure
rotate_wait
: If you are using thetail
input plugin, you might want to increase therotate_wait
parameter. This parameter tells Fluentd how long to wait before checking if a rotated log file has appeared.[INPUT] Name tail Path /path/to/your/log/file.log Parser your_parser Tag app.logs Rotate_Wait 30s
4. Fluentd Buffering and Parsing Issues
If Fluentd encounters issues while buffering or parsing the log files, it might skip them.
Check Fluentd Logs: Fluentd's own logs might provide more detailed information about the issue.
tail -f /var/log/fluentd/fluentd.log
Check Parser Configuration: Ensure that the parser configuration matches the format of the log files. For example, if you're parsing JSON, make sure the JSON structure is correct and consistent.
5. Log File Encoding Issues
Fluentd might encounter issues if the log file has an unexpected encoding.
Check Encoding: Ensure that the log file is in the expected encoding (e.g., UTF-8). You can use the
file
command to check the encoding:file -i /path/to/your/log/file.log
If necessary, convert the encoding:
iconv -f <source-encoding> -t utf-8 /path/to/your/log/file.log -o /path/to/your/converted/log/file.log
6. Monitor Fluentd's Retry Mechanism
Fluentd will typically retry reading files it couldn’t read previously. Ensure the issue isn’t transient by monitoring for further errors after fixing the possible causes.
Final Steps
Restart Fluentd: After making the necessary adjustments, restart Fluentd to ensure the changes take effect:
sudo systemctl restart fluentd
Monitor Logs: Continue to monitor Fluentd's logs to ensure that the issue has been resolved and that logs are being processed as expected.
If the problem persists, you may need to provide additional log details or Fluentd configuration settings for more targeted troubleshooting.
Make your mark
Join the writer's program
Are you a developer and love writing and sharing your knowledge with the world? Join our guest writing program and get paid for writing amazing technical guides. We'll get them to the right readers that will appreciate them.
Write for usBuild on top of Better Stack
Write a script, app or project on top of Better Stack and share it with the world. Make a public repository and share it with us at our email.
community@betterstack.comor submit a pull request and help us build better products for everyone.
See the full list of amazing projects on github