logstash-output-elasticsearch 10.0.2-java → 10.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
  SHA256:
3
- metadata.gz: 90b70ef694ca408c5fe028903d6c9b1b6151eb98e99ecf57566cbf938e8ba2e2
4
- data.tar.gz: 0067f5844ee31e31ea545d5854aaad2e309b34c1148ad8c8e1685698eba3c96e
3
+ metadata.gz: 854ab6224b74941c16ddf992e2414c86b7a037de2adbd29974e89498211a42cf
4
+ data.tar.gz: c3a717d5cace3a2387eb319761eb8a8a6a9144d2c1bd69b35e52ae1db1cadca0
5
5
  SHA512:
6
- metadata.gz: 5ab0d62f7c399abde3fc3ca4df0a879ef792b95360f5ca78f61f2e24e1a3fc4aaab4436a3700f11c3238b9dcfa3ed9d425e0b8e321b6aa50d29720d0acc19d7e
7
- data.tar.gz: 4f7719371b9af4b9d1b1a4223b39835416734252804739f60174f5cbb68a61a97376b7fe53c0ab7e8ff71ba7871138fc9f28dde9cb8cd4d88e1085e35e04801d
6
+ metadata.gz: 6b0bd02cd4f576ade481cf60bc55b42ece3002ab53ab667f8c0a023c43ecfbb43f318ac4d2e712cb0d351fd181406aea3d6050d0401b9e22e4d092dae64f4be7
7
+ data.tar.gz: 1660fa95e938d2aa424d4328daf38cd42f17f58c01aa39cc5bf95c6fd1199ce3a8f4c38c40be811ff0b4f293f45dd5bef293300cddd97e7526b5f327209069a1
@@ -1,3 +1,6 @@
1
+ ## 10.1.0
2
+ - Added cluster id tracking through the plugin metadata registry [#857](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/857)
3
+
1
4
  ## 10.0.2
2
5
  - Fixed bug where index patterns in custom templates could be erroneously overwritten [#861](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/861)
3
6
 
@@ -47,6 +47,7 @@ module LogStash; module Outputs; class ElasticSearch;
47
47
  sleep_interval = next_sleep_interval(sleep_interval)
48
48
  end
49
49
  if successful_connection?
50
+ discover_cluster_uuid
50
51
  install_template
51
52
  setup_ilm if ilm_in_use?
52
53
  end
@@ -130,6 +131,15 @@ module LogStash; module Outputs; class ElasticSearch;
130
131
  @template_installed.make_true
131
132
  end
132
133
 
134
+ def discover_cluster_uuid
135
+ return unless defined?(plugin_metadata)
136
+ cluster_info = client.get('/')
137
+ plugin_metadata.set(:cluster_uuid, cluster_info['cluster_uuid'])
138
+ rescue => e
139
+ # TODO introducing this logging message breaks many tests that need refactoring
140
+ # @logger.error("Unable to retrieve elasticsearch cluster uuid", error => e.message)
141
+ end
142
+
133
143
  def check_action_validity
134
144
  raise LogStash::ConfigurationError, "No action specified!" unless @action
135
145
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-elasticsearch'
3
- s.version = '10.0.2'
3
+ s.version = '10.1.0'
4
4
  s.licenses = ['apache-2.0']
5
5
  s.summary = "Stores logs in Elasticsearch"
6
6
  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"
@@ -486,7 +486,6 @@ describe LogStash::Outputs::ElasticSearch do
486
486
 
487
487
  context 'handling elasticsearch document-level status meant for the DLQ' do
488
488
  let(:options) { { "manage_template" => false } }
489
- let(:logger) { subject.instance_variable_get(:@logger) }
490
489
 
491
490
  context 'when @dlq_writer is nil' do
492
491
  before { subject.instance_variable_set '@dlq_writer', nil }
@@ -494,7 +493,7 @@ describe LogStash::Outputs::ElasticSearch do
494
493
  context 'resorting to previous behaviour of logging the error' do
495
494
  context 'getting an invalid_index_name_exception' do
496
495
  it 'should log at ERROR level' do
497
- expect(logger).to receive(:error).with(/Could not index/, hash_including(:status, :action, :response))
496
+ subject.instance_variable_set(:@logger, double("logger").as_null_object)
498
497
  mock_response = { 'index' => { 'error' => { 'type' => 'invalid_index_name_exception' } } }
499
498
  subject.handle_dlq_status("Could not index event to Elasticsearch.",
500
499
  [:action, :params, :event], :some_status, mock_response)
@@ -503,7 +502,9 @@ describe LogStash::Outputs::ElasticSearch do
503
502
 
504
503
  context 'when getting any other exception' do
505
504
  it 'should log at WARN level' do
506
- expect(logger).to receive(:warn).with(/Could not index/, hash_including(:status, :action, :response))
505
+ dlog = double_logger = double("logger").as_null_object
506
+ subject.instance_variable_set(:@logger, dlog)
507
+ expect(dlog).to receive(:warn).with(/Could not index/, hash_including(:status, :action, :response))
507
508
  mock_response = { 'index' => { 'error' => { 'type' => 'illegal_argument_exception' } } }
508
509
  subject.handle_dlq_status("Could not index event to Elasticsearch.",
509
510
  [:action, :params, :event], :some_status, mock_response)
@@ -512,7 +513,9 @@ describe LogStash::Outputs::ElasticSearch do
512
513
 
513
514
  context 'when the response does not include [error]' do
514
515
  it 'should not fail, but just log a warning' do
515
- expect(logger).to receive(:warn).with(/Could not index/, hash_including(:status, :action, :response))
516
+ dlog = double_logger = double("logger").as_null_object
517
+ subject.instance_variable_set(:@logger, dlog)
518
+ expect(dlog).to receive(:warn).with(/Could not index/, hash_including(:status, :action, :response))
516
519
  mock_response = { 'index' => {} }
517
520
  expect do
518
521
  subject.handle_dlq_status("Could not index event to Elasticsearch.",
@@ -532,7 +535,7 @@ describe LogStash::Outputs::ElasticSearch do
532
535
  # We should still log when sending to the DLQ.
533
536
  # This shall be solved by another issue, however: logstash-output-elasticsearch#772
534
537
  it 'should send the event to the DLQ instead, and not log' do
535
- expect(dlq_writer).to receive(:write).with(:event, /Could not index/)
538
+ expect(dlq_writer).to receive(:write).once.with(:event, /Could not index/)
536
539
  mock_response = { 'index' => { 'error' => { 'type' => 'illegal_argument_exception' } } }
537
540
  subject.handle_dlq_status("Could not index event to Elasticsearch.",
538
541
  [:action, :params, :event], :some_status, mock_response)
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: 10.0.2
4
+ version: 10.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: 2019-04-18 00:00:00.000000000 Z
11
+ date: 2019-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement