filebeat是一個開源的檔案收集器,主要用于擷取日志檔案,并把它們發送到logstash或elasticsearch。filebeat不僅支援各版本的linux系統(centos5.6除外),在windows作業系統上也有很好的體驗。
安裝:
運作以下指令來安裝filebeat作為windows服務,進入cmd控制台
cd ‘c:\program files\filebeat’
c:\program files\filebeat> .\install-service-filebeat.ps1
執行報錯:

用以下指令執行:
powershell.exe -executionpolicy unrestricted -file .\install-service-filebeat.ps1
安裝完成後,修改filebeat.yml配置檔案,指定好上傳日志檔案的路徑等參數
啟動:
直接執行.exe程式即可
但是這裡有一個問題,程式隻能前台運作,一旦關閉cmd視窗,程式也會關閉,google了很多辦法,start /b參數嘗試也不行,後來搜到一個chp.exe程式,加在filebeat.exe前執行即可。
測試了最新版本5.0,以及1.3和1.2的filebeat版本,隻有1.2版本可以執行
1.3和5.0出現輸出報錯:
failed to initialize console plugin as output: console output initialization failed with: getfileinformationbyhandle /dev/stdout: the handle is invalid.