filebeat-1-聯通logstash

來源:互聯網
上載者:User

標籤:tps   ash   進入   開啟   sea   gre   rsh   修改   elastic   

Filebeat是一個記錄檔託運工具,在你的伺服器上安裝用戶端後,filebeat會監控日誌目錄或者指定的記錄檔,追蹤讀取這些檔案(追蹤檔案的變化,不停的讀),並且轉寄這些資訊到elasticsearch或者logstarsh中存放。

當你開啟filebeat程式的時候,它會啟動一個或多個探測器(prospectors)去檢測你指定的日誌目錄或檔案,對於探測器找出的每一個記錄檔,filebeat啟動收割進程(harvester),每一個收割進程讀取一個記錄檔的新內容,並發送這些新的日誌資料到處理常式(spooler),處理常式會集合這些事件,最後filebeat會發送集合的資料到你指定的地點。

安裝配置: 

filebeat的安裝配置非常簡單

1, 下載

這兒使用的版本是 5.5.2

2, 定義日誌路徑配置

進入到解壓目錄下, 然後修改  filebeat.yml

- input_type: log  # Paths that should be crawled and fetched. Glob based paths.  paths:    - /var/log/nginx/*.log    #- c:\programdata\elasticsearch\logs\*  #exclude_lines: ["^DBG"]  #include_lines: ["^ERR", "^WARN"]

這兒可以配置多個路徑, 並且使用正則進行日誌抽取時的過濾

3, 輸出日誌路徑: 

filebeat的輸出可以有多種目的地, es, logstash

elasticsearch: 

#-------------------------- Elasticsearch output ------------------------------#output.elasticsearch:  # Array of hosts to connect to. # hosts: ["localhost:9200"]  # Optional protocol and basic auth credentials.  #protocol: "https"  #username: "elastic"  #password: "changeme"

logstash: 

#----------------------------- Logstash output --------------------------------output.logstash:  # The Logstash hosts  hosts: ["www.wenbronk.com:5044"]
4, 啟動logstash
nohup ./filebeat -c ./filebeat.yml &
logstash 和 filebeat 連通: 

這兒我們以 nginx的日誌為例, nginx的安裝可見: 

http://www.cnblogs.com/wenbronk/p/6557482.html

1, 配置logstash並啟動
input {    beats {        port => "5044"    }}output {    stdout {        codec => rubydebug    }}

啟動: 

./bin/logstash -f ./config/logstash_conf.conf 

 

2, 配置filebeat並啟動
cat filebeat.yml | grep -v ‘^$‘ | grep -v ‘#‘

 

 3, 然後瀏覽器訪問, 即可以看到logstash的 控制台進行了輸出, 證明連通 

 

參考: http://www.ywnds.com/?p=9776

filebeat-1-聯通logstash

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.