filebeat優化參數
html
filebeat的配置文件filebeat.yml,其實有兩個參數,windows
close_older: 1happ
說明:Close older closes the file handler for which were not modified for longer then close_older. Time strings like 2h (2 hours), 5m (5 minutes) can be used.ide
即若是一個文件在某個時間段內沒有發生過更新,則關閉監控的文件handle,默認1小時。
優化
force_close_files: falsethis
說明:This option closes a file, as soon as the file name changes. This config option is recommended on windows only. Filebeat keeps the files it's reading open. This can cause issues when the file is removed, as the file will not be fully removed until also Filebeat closes the reading. Filebeat closes the file handler after ignore_older. During this time no new file with the same name can be created. Turning this feature on the other hand can lead to loss of data on rotate files. It can happen that after file rotation the beginning of the new file is skipped, as the reading starts at the end. We recommend to leave this option on false but lower the ignore_older value to release files faster.
spa
即當文件名稱有變化時,包括更名和刪除,會自動關閉一個文件。日誌
這兩個參數結合起來,根據應用需求,一個文件30分鐘內不更新,則須要關閉句柄,文件更名或刪除,須要關閉句柄,htm
close_older: 30m
blogforce_close_files: true
能夠知足,filebeat採集日誌,以及定時刪除歷史文件,這兩個任務的基本要求。
filebeat部署連接
http://www.javashuo.com/article/p-gnyvefiz-kw.html
從零進階--教你如何使用Filebeat實現日誌可視化收集