From d5271f999ac9301fa319c89c7823a926b7b3da2d Mon Sep 17 00:00:00 2001 From: Andrew Cholakian Date: Tue, 7 Feb 2017 09:53:06 -0600 Subject: [PATCH] Revert "Use manticore client" we didn't need to make that change after all This reverts commit 611e74cb18bc1a1b1d7b9ca51cf419ed1175b485. Fixes #57 --- CHANGELOG.md | 4 ---- lib/logstash/inputs/elasticsearch.rb | 22 +++++++--------------- logstash-input-elasticsearch.gemspec | 6 ++---- 3 files changed, 9 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a116b3e..fafa5ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,3 @@ -## 4.0.1 - - Switch internal HTTP client to support TLSv1.2 - - Upgrade ES client internally to better support ES 5.x - ## 4.0.0 - Remove `scan` from list of options as this is no longer allowed in Elasticsearch 5.0. diff --git a/lib/logstash/inputs/elasticsearch.rb b/lib/logstash/inputs/elasticsearch.rb index a43ff48..b167609 100644 --- a/lib/logstash/inputs/elasticsearch.rb +++ b/lib/logstash/inputs/elasticsearch.rb @@ -1,8 +1,6 @@ # encoding: utf-8 require "logstash/inputs/base" require "logstash/namespace" -require 'elasticsearch' -require 'elasticsearch/transport/transport/http/manticore' require "base64" # Read from an Elasticsearch cluster, based on search query results. @@ -107,6 +105,8 @@ class LogStash::Inputs::Elasticsearch < LogStash::Inputs::Base config :ca_file, :validate => :path def register + require "elasticsearch" + @options = { :index => @index, :body => @query, @@ -117,10 +117,8 @@ def register transport_options = {} if @user && @password - transport_options[:auth] = { - :user => @user, - :password => @password.value - } + token = Base64.strict_encode64("#{@user}:#{@password.value}") + transport_options[:headers] = { :Authorization => "Basic #{token}" } end hosts = if @ssl then @@ -132,17 +130,11 @@ def register @hosts end - client_options = { - :hosts => hosts, - :transport_options => transport_options, - :transport_class => Elasticsearch::Transport::Transport::HTTP::Manticore - } - if @ssl && @ca_file - client_options[:ssl] = { :enabled => true, :ca_file => @ca_file } + transport_options[:ssl] = { :ca_file => @ca_file } end - - @client = Elasticsearch::Client.new(client_options) + + @client = Elasticsearch::Client.new(:hosts => hosts, :transport_options => transport_options) end def run(output_queue) diff --git a/logstash-input-elasticsearch.gemspec b/logstash-input-elasticsearch.gemspec index de82754..7640b3a 100644 --- a/logstash-input-elasticsearch.gemspec +++ b/logstash-input-elasticsearch.gemspec @@ -1,7 +1,7 @@ Gem::Specification.new do |s| s.name = 'logstash-input-elasticsearch' - s.version = '4.0.1' + s.version = '4.0.0' s.licenses = ['Apache License (2.0)'] s.summary = "Read from an Elasticsearch cluster, based on search query results" 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" @@ -22,9 +22,7 @@ Gem::Specification.new do |s| # Gem dependencies s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99" - s.add_runtime_dependency 'elasticsearch', ['>= 5.0.0', '< 6.0.0'] - s.add_runtime_dependency "manticore", '>= 0.5.4', '< 1.0.0' - + s.add_runtime_dependency 'elasticsearch', ['>= 1.0.6', '~> 1.0'] s.add_runtime_dependency 'logstash-codec-json'