Linux上簡單安裝測試Logstash
入門學習ELK,本文簡單記錄了我在centos6.8安裝過程。
安裝包:logstash-6.2.2.tar.gz
安裝位置:/usr/local/software
解壓即可。
------------------------------------
測試一、
啟動命令: ./bin/logstash -e 'input {stdin {}} output {stdout {}}'
簡單解釋:'input {stdin {}} 為控制檯輸入 output {stdout {}}為控制檯輸出 |
啟動成功後輸入nihao回車後返回nihao
-----------------------------------
測試二、input為activeMQ output為logstash控制檯
參考資料 https://www.tuicool.com/articles/nueeee2
安裝logstash的jms外掛
.bin/logstash-plugin install logstash-input-jms
.bin/logstash-plugin install logstash-input-stomp
啟動
./bin/logstash -f ./config/zidingyi/activemq_logstash.conf
activemq_logstash.conf為:
我向activemq發了一個訊息。
得到返回
-----------------------------------
測試三、input為activeMQ output為elasticsearch
input { stomp { host => "10.10.175.109" #我筆記本的ip destination => "elkTestQueue" } } # filter { # # } output{ elasticsearch{ hosts=>["192.168.160.128:9200"] index => "es-message-%{+YYYY.MM.dd}" } stdout{codec => rubydebug} } |
向activemq傳資料後
可用再kibana中看到
-----------------------------------
測試四、input為kafka output為elasticsearch
input { kafka { bootstrap_servers => "10.10.103.86:9092,10.10.103.86:9093,10.10.103.86:9094" #kafka client_id => "test" group_id => "test" auto_offset_reset => "latest" #從最新的偏移量開始消費 consumer_threads => 5 decorate_events => true #此屬性會將當前topic、offset、group、partition等資訊也帶到message中 topics => ["kafkaTest","test"] type => "bhy" } } # filter { # # } output { elasticsearch { hosts=>["192.168.160.128:9200"] index => "es-message-%{+YYYY.MM.dd}" } stdout{codec => rubydebug} } |