logstash學(xué)習(xí)第一天

官方文檔:
doc:http://udn.yyuap.com/doc/logstash-best-practice-cn/filter/index.html
code:https://github.com/elastic/logstash

一. 學(xué)習(xí)插件 Logstash HTTP input plugin

1 修改配置文件

input
{
   http 
   { 
     host => "127.0.0.1"
     port => 31311  #接受http請(qǐng)求 
         additional_codecs => {"application/json"=>"json"}
         codec => "plain"
         threads => 4
         ssl => false
    } 
             
}
filter
 {
  #過濾不需要請(qǐng)求   
}
output
{
      stdout { codec => rubydebug}
}
 

logstash -f /home/wangchuanyi/ob_rel/logstash-5.4.1/config/logstashHttp.conf

2 curl測試

curl  -H "content-type: application/json" 
      -XPUT 'http://127.0.0.1:31311/test/' 
     -d '{ "name" : "troy", "pwd" : "今天發(fā)蘋果吃了 " }' 

查看logstash日志:


logstash輸出到屏幕上.png

總結(jié):Flume 和logstash 都可以接受http請(qǐng)求 前者寫代碼 后者通過配置來控制

參考

1 https://www.elastic.co/blog/introducing-logstash-input-http-plugin#sthash.alyYTzAS.dpbs
2 http://www.cnblogs.com/xing901022/p/5256227.html

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容