logstash-output-elasticsearch 1.0.7-java → 1.1.0-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6859ba9736d257c039dd16c08ee0d9e6e233c914
4
- data.tar.gz: f645572dac0a860dce40e09d5f81e732b37abab3
3
+ metadata.gz: 21f30a9fb4fae09d20c43211c4a47a38a99892d0
4
+ data.tar.gz: c8a82c32a338ecc12109b251efab824707770429
5
5
  SHA512:
6
- metadata.gz: 3fb6d1a7ecb3c40b2f376cb50f00db79e9573cd2cdad844d71e4aae3523aa76a2d2e018fa72916625d9eab414a4bfdd16733b1a8ec01add0020fe530268622ae
7
- data.tar.gz: f05821d1741b5b478090cbcb328aa4e33141d2b796b0dcf02bccaea3ab7c18910564f54bdc631b23effb7063e25d4f2c1b119f8febc5b5cb6c9f9d3d924d079c
6
+ metadata.gz: 1db3b07141dd557c7fcd34dfcfe64fb7705c9c776faf5a9455c6417be00cd23b20e2e267dbcbdbd7477d3c54ac80ea30a65cfe69482722c98ad3505d934ef97b
7
+ data.tar.gz: cc2c42fd9b8af5caab9b6b15d957d988c7f0c748da737d9449abcd8202ef6f41ac8148c7f77c32a5b92641e43b3a334654f636a0541230f21375aab5820d4c67
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 1.1.0
2
+ - Add timeout setting.
3
+
1
4
  ## 1.0.7
2
5
  - Add update API support
3
6
 
@@ -326,6 +326,11 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
326
326
  # create a new document with this parameter as json string if document_id doesn't exists
327
327
  config :upsert, :validate => :string, :default => ""
328
328
 
329
+
330
+ # Set the timeout for network operations and requests sent Elasticsearch. If
331
+ # a timeout occurs, the request will be retried.
332
+ config :timeout, :validate => :number
333
+
329
334
  public
330
335
  def register
331
336
  @submit_mutex = Mutex.new
@@ -396,6 +401,7 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
396
401
  :client_settings => client_settings
397
402
  }
398
403
 
404
+ common_options[:timeout] = @timeout if @timeout
399
405
  common_options.merge! setup_basic_auth()
400
406
 
401
407
  # Update API setup
@@ -62,13 +62,14 @@ module LogStash::Outputs::Elasticsearch
62
62
 
63
63
  def build_client(options)
64
64
  uri = "#{options[:protocol]}://#{options[:host]}:#{options[:port]}#{options[:client_settings][:path]}"
65
+ timeout = options[:timeout] || 0
65
66
 
66
67
  client_options = {
67
68
  :host => [uri],
68
69
  :ssl => options[:client_settings][:ssl],
69
70
  :transport_options => { # manticore settings so we
70
- :socket_timeout => 0, # do not timeout socket reads
71
- :request_timeout => 0, # and requests
71
+ :socket_timeout => timeout, # do not timeout socket reads
72
+ :request_timeout => timeout, # and requests
72
73
  :proxy => options[:client_settings][:proxy]
73
74
  },
74
75
  :transport_class => ::Elasticsearch::Transport::Transport::HTTP::Manticore
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-output-elasticsearch'
4
- s.version = '1.0.7'
4
+ s.version = '1.1.0'
5
5
  s.licenses = ['apache-2.0']
6
6
  s.summary = "Logstash Output to Elasticsearch"
7
7
  s.description = "Output events to elasticsearch"
@@ -37,4 +37,5 @@ Gem::Specification.new do |s|
37
37
 
38
38
  s.add_development_dependency 'logstash-devutils'
39
39
  s.add_development_dependency 'longshoreman'
40
+ s.add_development_dependency 'flores'
40
41
  end
@@ -1,4 +1,5 @@
1
1
  require_relative "../../../spec/es_spec_helper"
2
+ require "flores/random"
2
3
 
3
4
  describe "outputs/elasticsearch" do
4
5
  context "registration" do
@@ -154,4 +155,45 @@ describe "outputs/elasticsearch" do
154
155
  end
155
156
  end
156
157
  end
158
+
159
+
160
+ # TODO(sissel): Improve this. I'm not a fan of using message expectations (expect().to receive...)
161
+ # especially with respect to logging to verify a failure/retry has occurred. For now, this
162
+ # should suffice, though.
163
+ context "with timeout set" do
164
+ let(:listener) { Flores::Random.tcp_listener }
165
+ let(:port) { listener[2] }
166
+ let(:options) do
167
+ {
168
+ "protocol" => "http",
169
+ "manage_template" => false,
170
+ "host" => "localhost",
171
+ "port" => port,
172
+ "flush_size" => 1,
173
+ "timeout" => 1,
174
+ }
175
+ end
176
+ let(:eso) {LogStash::Outputs::ElasticSearch.new(options)}
177
+
178
+ before do
179
+ eso.logger = Cabin::Channel.get
180
+ eso.register
181
+
182
+ # Expect a timeout to be logged.
183
+ expect(eso.logger).to receive(:warn).with("Failed to flush outgoing items",
184
+ hash_including(:exception => "Manticore::SocketTimeout"))
185
+ end
186
+
187
+ after do
188
+ listener[0].close
189
+ eso.close
190
+ end
191
+
192
+ it "should fail after the timeout" do
193
+ Thread.new { eso.receive(LogStash::Event.new) }
194
+
195
+ # Allow the timeout to occur.
196
+ sleep(options["timeout"] + 0.5)
197
+ end
198
+ end
157
199
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.1.0
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-11 00:00:00.000000000 Z
11
+ date: 2015-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -168,6 +168,20 @@ dependencies:
168
168
  version: '0'
169
169
  prerelease: false
170
170
  type: :development
171
+ - !ruby/object:Gem::Dependency
172
+ name: flores
173
+ version_requirements: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - '>='
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ requirement: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - '>='
181
+ - !ruby/object:Gem::Version
182
+ version: '0'
183
+ prerelease: false
184
+ type: :development
171
185
  description: Output events to elasticsearch
172
186
  email: info@elastic.co
173
187
  executables: []
@@ -239,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
253
  version: '0'
240
254
  requirements: []
241
255
  rubyforge_project:
242
- rubygems_version: 2.1.9
256
+ rubygems_version: 2.4.8
243
257
  signing_key:
244
258
  specification_version: 4
245
259
  summary: Logstash Output to Elasticsearch