Logstash 插件集成(简易版)

1.切换到插件目录

1
cd logstash-5.2.2/vendor/bundle/jruby/1.9/gems/

2.生成模板插件

1
logstash-plugin generate --type filter --name alioss --path ./

3.配置 logstash-5.2.2/Gemfile 文件,添加一条

1
gem "logstash-filter-alioss", :path => "vendor/bundle/jruby/1.9/gems/logstash-filter-alioss"

4.验证

1
logstash -e 'input { stdin { } } filter { alioss{ } } output { stdout {codec=>rubydebug} }'

会得到如下结果

1
2
3
4
5
6
{
"@timestamp" => 2017-03-14T09:32:23.423Z,
"@version" => "1",
"host" => "renyufengdeMacBook-Pro.local",
"message" => "Hello World!"
}