close
這問題會出現在使用logstash讀入同樣檔名的file時出現 但從elasticsearch裡卻完全沒看到我們的資料
使用debug mode只看到logstash不斷的出現
_discover_file_glob: /var/log/test/: glob is: ["/var/log/test/test.json"] {:level=>:debug, :file=>"filewatch/watch.rb", :line=>"117"}
_discover_file_glob: /var/log/test/: glob is: ["/var/log/test/test.json"] {:level=>:debug, :file=>"filewatch/watch.rb", :line=>"117"}
其實這並不是bug 而是logstash是一個輸入流 所以當你舊的資料沒有更動又重讀進去後 logstash自然會從上次的結尾地方 並等待新的data
因此解決的辦法有兩個步驟
1. 在input裡加入start_position => "beginning" 這個在default值是"end"也就是結尾
ex.
input{
file{
path => "/tmp/xxx.log"
start_position => "beginning"
}
}
2.刪除logstash的暫存檔
\rm ~/.sincedb*
結尾的星號很重要 這樣才刪的乾淨
接著再重新呼叫自己的config就可以了
全站熱搜
留言列表