logstash 收集windows日誌--解決日誌不能重新命名問題

來源:互聯網
上載者:User

標籤:windows log file not rotating   logstash lock 檔案被佔用

logstash 在windows中收集日誌的時候,會導致寫日誌的程式不能進行日誌的切割(windows提示,檔案被佔用)


從github上下載useJavatoOpenFile    https://github.com/edwinf/ruby-filewatch/tree/useJavatoOpenFile

wget https://github.com/jordansissel/ruby-filewatch/archive/master.zip

解壓縮後

使用解壓縮工具開啟logstash-1.3.3.jar,添加java\JRubyFileExtension.jar 到目前的目錄

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/48/49/wKioL1QGvt2BVQM4AASq7V5epN4479.jpg" style="width:600px;height:296px;" title="1.jpg" width="600" height="296" border="0" hspace="0" vspace="0" alt="wKioL1QGvt2BVQM4AASq7V5epN4479.jpg" />



然後添加lib\filewatch下所有ruby檔案到filewatch目錄

650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/48/4A/wKioL1QGvyWREBX8AAGxf7SWsns852.jpg" title="2.jpg" width="600" height="290" border="0" hspace="0" vspace="0" style="width:600px;height:290px;" alt="wKioL1QGvyWREBX8AAGxf7SWsns852.jpg" />






在cmd命令列中輸入 

set CloseAfterRead=true

然後啟動logstash

java -jar logstash-1.3.3.jar agent -f config.conf


參考資料:

http://cookbook.logstash.net/recipes/windows-service/

http://serverfault.com/questions/563235/nxlog-file-input-search-patterns

https://logstash.jira.com/browse/LOGSTASH-986


本文出自 “掃榻人” 部落格,請務必保留此出處http://enable.blog.51cto.com/747951/1548326

logstash 收集windows日誌--解決日誌不能重新命名問題

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.