logstash-output-elasticsearch 0.1.13-java → 0.1.14-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 851fa04145331bbf46a5859e27197d72bcbf4e0d
4
- data.tar.gz: cea045af69707fb9b874df6b1a88fff1a1a4e0a4
3
+ metadata.gz: 0e4a66a8523f9b25e672600abedcf3461bf34eed
4
+ data.tar.gz: 5f3b8251db88fbae965f0b2beeae37502b4bc678
5
5
  SHA512:
6
- metadata.gz: e7a2f8d4c9f8d52faf318da314460862515d3584c46beb90582b189d8795b7d7ff8a60fa340658e6be12a950c08b674fc376096439cd1eafeea61ad59c6606af
7
- data.tar.gz: 28668b405794ad2f0ea8876c603b83298f5b61d2f3c6b52bfe493cfe096c11427ab7a953b7db7b104fdef5b4023f5e6f12b788c4d67e84a33fbe8018d7bc2efe
6
+ metadata.gz: 8e7c5d3a6dfeb1cb93c69c4e87c56c911ff001fa91b26dfc9f454f54a1f5e71603c4308ac7403deab57c36c14e4346c87d038aebf3bb9d1bcf88bd8fcce34679
7
+ data.tar.gz: 1b21efc5c97a06c7dfb56f5eea73319b34cc33f6f22be375652e785d26b61904a9f16f2805e25a9ba74cabd6a004e936f4ac1e6cb586a7b2baac0ffc35d76cf1
@@ -419,9 +419,8 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
419
419
  end
420
420
  end
421
421
 
422
- # Does not raise an exception to prevent Stud::Buffer from
423
- # attempting to resubmit successful actions within the bulk
424
- # request.
422
+ # When there are exceptions raised upon submission, we raise an exception so that
423
+ # Stud::Buffer will retry to flush
425
424
  public
426
425
  def flush(actions, teardown = false)
427
426
  begin
@@ -429,6 +428,7 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
429
428
  submit(actions)
430
429
  rescue => e
431
430
  @logger.error "Got error to send bulk of actions to elasticsearch server at #{@host[@client_idx]} : #{e.message}"
431
+ raise e
432
432
  ensure
433
433
  unless @protocol == "node"
434
434
  @logger.debug? and @logger.debug "Shifting current elasticsearch client"
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-output-elasticsearch'
4
- s.version = '0.1.13'
4
+ s.version = '0.1.14'
5
5
  s.licenses = ['apache-2.0']
6
6
  s.summary = "Logstash Output to Elasticsearch"
7
7
  s.description = "Output events to elasticsearch"
@@ -113,7 +113,7 @@ describe "outputs/elasticsearch" do
113
113
  end
114
114
  end
115
115
 
116
- it "should creat new documents without id" do
116
+ it "should create new documents without id" do
117
117
  subject = get_es_output("create")
118
118
  subject.register
119
119
  subject.receive(LogStash::Event.new("message" => "sample message here"))
@@ -142,16 +142,11 @@ describe "outputs/elasticsearch" do
142
142
  end
143
143
 
144
144
  it "should fail to create a document when no id is specified" do
145
- subject = get_es_output("create_unless_exists")
145
+ event = LogStash::Event.new("somevalue" => 100, "@timestamp" => "2014-11-17T20:37:17.223Z", "@metadata" => {"retry_count" => 0})
146
+ action = ["create_unless_exists", {:_id=>nil, :_index=>"logstash-2014.11.17", :_type=>"logs"}, event]
147
+ subject = get_es_output(action[0])
146
148
  subject.register
147
- subject.receive(LogStash::Event.new("message" => "sample message here"))
148
- subject.buffer_flush(:final => true)
149
- es.indices.refresh
150
- # Wait or fail until everything's indexed.
151
- Stud::try(3.times) do
152
- r = es.search
153
- insist { r["hits"]["total"] } == 0
154
- end
149
+ expect { subject.flush([action]) }.to raise_error
155
150
  end
156
151
 
157
152
  it "should unsuccesfully submit two records with the same document id" do
@@ -532,6 +527,20 @@ describe "outputs/elasticsearch" do
532
527
  sleep(2)
533
528
  end
534
529
 
530
+ it "should raise exception and be retried by stud::buffer" do
531
+ call_count = 0
532
+ expect(subject).to receive(:submit).with([action1]).exactly(3).times do
533
+ if (call_count += 1) <= 2
534
+ raise "error first two times"
535
+ else
536
+ {"errors" => false}
537
+ end
538
+ end
539
+ subject.register
540
+ subject.receive(event1)
541
+ subject.buffer_flush(:final => true)
542
+ end
543
+
535
544
  it "should retry actions with response status of 503" do
536
545
  mock_actions_with_response({"errors" => true, "statuses" => [200, 200, 503, 503]},
537
546
  {"errors" => true, "statuses" => [200, 503]},
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: 0.1.13
4
+ version: 0.1.14
5
5
  platform: java
6
6
  authors:
7
7
  - Elasticsearch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-29 00:00:00.000000000 Z
11
+ date: 2015-02-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby