-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Excessive disk usage - filebeat #673
Comments
I assume that this related to the open files. Filebeat by default keeps the files open for 24 hours based on the ignore_older config. If a file is deleted but filebeat still has the file handler open, the file disappears but still takes up space on your disk. I assume you delete files quite frequently. There are two options to tackle this problem: Either lower ignore_older to the maximum time file updates could still happen or use "force_close_files" which directly closes a file when it is rotated. I recommend the first option as the second can lead to missing events on file rotation. For reference the links to the docs: |
Not that frequently. The only input for filebeat is the file As the file is never deleted, could it be that it's holding onto the older data from before truncation occurred? |
Checking the openfiles for the filebeat process (pre restart) shows this:
Then after the process is restarted:
|
So the file /var/log/syslog.2 is deleted every 24 hours, correct? And you use the default ignore_older config? Could you update to filebeat 1.0.1 to see if the issue persists or even going to the snapshot of 1.1? We fixed there one issue related to closing files. Even though I think it is not to the case that we have here, it would be good to know if the never version resolves it. Could your share part of your log file written by filebeat? It would be good to see what filebeat thinks about the "last modified date" of the files deleted. |
I think my issue was more down to a misconfiguration of logrotate. We hadn't actually specified However, it does seems odd that filebeat would hold onto so many deleted files especially as they would have been deleted more than 24 hours ago. |
@markunsworth Yes, filebeat should not keep the file open if they were not modified. 1.0.1 should have here some improvements and more to come: #718 Let me know if you still have the problem with your changes you made and version 1.0.1. In case the problem is solved, please close the issue. |
@ruflin I am running into the same issue. I have tried both 1.1.0 release and Feb 9th nightly release with close_older flag. Filebeat does not release the old files. I have also tried to test with force_close_files: true with no success, I was hoping force close would release the files on rotation.
My Config:
|
This could be related to the issue here: #922 |
Since changing our logrotate configs and upgrading to filebeat 1.0.1 we're no longer getting the same fileusage problems and we don't see filebeat holding onto deleted file handles. However, I think that is more likely down to the change in the logrotate functionality as we weren't using
meaning filebeat was holding onto the original handle as the file was renamed, but also picking up the newly created syslog file as that was the file in the prospector paths. @mohamabid - I would suggest making sure your logrotate scripts are set up so that files aren't moved/renamed to fix this quickly |
@markunsworth Interesting note. It "should" work in both cases. In our system tests we always use the renaming of files and creating a new one. If I understand you right that is what didn't work before? Now also version 1.1 is available. |
It held onto the renamed ones but didn't release them when they were eventually deleted |
We did several improvements on the file handler closing. 1.2.2 is now out. Closing this issue. Please reopen if this happens again. |
Since installing filebeat (version 1.0.0) we noticed that servers with high log volumes were running out of disk space, looking at the logfiles they weren't using up more than 10% of the total available space on the disk. The majority of logfiles are rotated nightly using logrotate.
When we restart the filebeat service the disk usage drops by 70%.
Here's our filebeat.yml config:
The text was updated successfully, but these errors were encountered: