From c125ce25eaace4726872096894c1a970a8a6dc22 Mon Sep 17 00:00:00 2001 From: Tal Levy Date: Mon, 16 May 2016 13:43:39 -0700 Subject: [PATCH] update to use new event api and logstash plugin api 2.0 --- .travis.yml | 4 ++-- CHANGELOG.md | 8 +++++--- lib/logstash/outputs/webhdfs.rb | 2 +- logstash-output-webhdfs.gemspec | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.travis.yml b/.travis.yml index 350c4eb..bae23d8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,6 @@ sudo: false language: ruby cache: bundler rvm: - - jruby-1.7.23 -script: + - jruby-1.7.25 +script: - bundle exec rspec spec diff --git a/CHANGELOG.md b/CHANGELOG.md index 009ad16..2b7978f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,13 @@ +# 3.0.0 + - Use new Event API defined in Logstash 5.x (backwards incompatible change) # 2.0.4 - Depend on logstash-core-plugin-api instead of logstash-core, removing the need to mass update plugins on major releases of logstash # 2.0.3 - New dependency requirements for logstash-core for the 5.0 release ## 2.0.0 - - Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully, + - Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully, instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895 - Dependency on logstash-core update to 2.0 -## 0.1.0 -* First version of the webhdfs plugin output +## 0.1.0 +* First version of the webhdfs plugin output diff --git a/lib/logstash/outputs/webhdfs.rb b/lib/logstash/outputs/webhdfs.rb index 30a3ca2..ffe047a 100755 --- a/lib/logstash/outputs/webhdfs.rb +++ b/lib/logstash/outputs/webhdfs.rb @@ -173,7 +173,7 @@ def flush(events=nil, close=false) events.collect do |event| # Add thread_id to event metadata to be used as format value in path configuration. if @single_file_per_thread - event['@metadata']['thread_id'] = Thread.current.object_id.to_s + event.set("[@metadata][thread_id]", Thread.current.object_id.to_s) end path = event.sprintf(@path) event_as_string = @codec.encode(event) diff --git a/logstash-output-webhdfs.gemspec b/logstash-output-webhdfs.gemspec index 0dfe09b..804daa6 100644 --- a/logstash-output-webhdfs.gemspec +++ b/logstash-output-webhdfs.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.name = 'logstash-output-webhdfs' - s.version = '2.0.4' + s.version = '3.0.0' s.licenses = ['Apache License (2.0)'] s.summary = "Plugin to write events to hdfs via webhdfs." s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program" @@ -20,7 +20,7 @@ Gem::Specification.new do |s| s.metadata = { "logstash_plugin" => "true", "logstash_group" => "output" } # Gem dependencies - s.add_runtime_dependency "logstash-core-plugin-api", "~> 1.0" + s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0" s.add_runtime_dependency 'webhdfs' s.add_runtime_dependency 'snappy', "= 0.0.12" s.add_development_dependency 'logstash-devutils'