logstash-output-elasticsearch 11.15.0-java → 11.15.1-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: e99f37b77580192819e3215149302e093a99906de26cdf613e4b6c6b24dacda5
4
- data.tar.gz: 6a18546d9e7f1fab675c4a88c1728646613cff63dc87dab5a2bac1756642b91f
3
+ metadata.gz: 6ad6b80e4c6db7a54c8b7a830f6a922a7057b2e7585820db8a6c093b57db3800
4
+ data.tar.gz: 82cd893394fc7ac08ae7a79b2cd953f80fbf258ec2faad225300a2ce516ab208
5
5
  SHA512:
6
- metadata.gz: 3fb0cf262bf06830ae5089095f5421920f4ffad6936060df74286bf6aadbd18f729bca32021df94f7cb6251b48a6d25d7e00b849d83a5534718f2b0248c73e9c
7
- data.tar.gz: 50ddf8e65adb4d9b4e67519edaf19bf9b1f127fecc3d8b7736505d20bde0eac822c7d554f208aeed812efe3166940fba7655e484b40ce217785e92136594ad6a
6
+ metadata.gz: b861d195377c3eeadf4489d21780be6627597aa0b93992bd7378b7cf680f6f99ac120ae342a4b48739ee6ef2652aa9238ee9fc08838cbed0f6dae0c887b06daa
7
+ data.tar.gz: 16091be406132dbb590ad76a0ba2e83cb0729717d8229b410bccbcabc660a7a26146fd2c7aaae6976f954bd17f1f763c6353552699ffd67173efb9917b913658
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 11.15.1
2
+ - Move async finish_register to bottom of register to avoid race condition [#1125](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1125)
3
+
1
4
  ## 11.15.0
2
5
  - Added the ability to negatively acknowledge the batch under processing if the plugin is blocked in a retry-error-loop and a shutdown is requested. [#1119](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1119)
3
6
 
@@ -313,6 +313,27 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
313
313
  data_stream_enabled = data_stream_config?
314
314
 
315
315
  setup_template_manager_defaults(data_stream_enabled)
316
+ # To support BWC, we check if DLQ exists in core (< 5.4). If it doesn't, we use nil to resort to previous behavior.
317
+ @dlq_writer = dlq_enabled? ? execution_context.dlq_writer : nil
318
+
319
+ @dlq_codes = DOC_DLQ_CODES.to_set
320
+
321
+ if dlq_enabled?
322
+ check_dlq_custom_codes
323
+ @dlq_codes.merge(dlq_custom_codes)
324
+ else
325
+ raise LogStash::ConfigurationError, "DLQ feature (dlq_custom_codes) is configured while DLQ is not enabled" unless dlq_custom_codes.empty?
326
+ end
327
+
328
+ setup_mapper_and_target(data_stream_enabled)
329
+
330
+ @bulk_request_metrics = metric.namespace(:bulk_requests)
331
+ @document_level_metrics = metric.namespace(:documents)
332
+
333
+ if ecs_compatibility == :v8
334
+ @logger.warn("Elasticsearch Output configured with `ecs_compatibility => v8`, which resolved to an UNRELEASED preview of version 8.0.0 of the Elastic Common Schema. " +
335
+ "Once ECS v8 and an updated release of this plugin are publicly available, you will need to update this plugin to resolve this warning.")
336
+ end
316
337
 
317
338
  @after_successful_connection_thread = after_successful_connection do
318
339
  begin
@@ -326,18 +347,9 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
326
347
  end
327
348
  end
328
349
 
329
- # To support BWC, we check if DLQ exists in core (< 5.4). If it doesn't, we use nil to resort to previous behavior.
330
- @dlq_writer = dlq_enabled? ? execution_context.dlq_writer : nil
331
-
332
- @dlq_codes = DOC_DLQ_CODES.to_set
333
-
334
- if dlq_enabled?
335
- check_dlq_custom_codes
336
- @dlq_codes.merge(dlq_custom_codes)
337
- else
338
- raise LogStash::ConfigurationError, "DLQ feature (dlq_custom_codes) is configured while DLQ is not enabled" unless dlq_custom_codes.empty?
339
- end
350
+ end
340
351
 
352
+ def setup_mapper_and_target(data_stream_enabled)
341
353
  if data_stream_enabled
342
354
  @event_mapper = -> (e) { data_stream_event_action_tuple(e) }
343
355
  @event_target = -> (e) { data_stream_name(e) }
@@ -346,14 +358,6 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
346
358
  @event_mapper = -> (e) { event_action_tuple(e) }
347
359
  @event_target = -> (e) { e.sprintf(@index) }
348
360
  end
349
-
350
- @bulk_request_metrics = metric.namespace(:bulk_requests)
351
- @document_level_metrics = metric.namespace(:documents)
352
-
353
- if ecs_compatibility == :v8
354
- @logger.warn("Elasticsearch Output configured with `ecs_compatibility => v8`, which resolved to an UNRELEASED preview of version 8.0.0 of the Elastic Common Schema. " +
355
- "Once ECS v8 and an updated release of this plugin are publicly available, you will need to update this plugin to resolve this warning.")
356
- end
357
361
  end
358
362
 
359
363
  # @override post-register when ES connection established
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-elasticsearch'
3
- s.version = '11.15.0'
3
+ s.version = '11.15.1'
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"
@@ -1456,6 +1456,42 @@ describe LogStash::Outputs::ElasticSearch do
1456
1456
  end
1457
1457
 
1458
1458
  end
1459
+
1460
+ context 'during register/finish_register' do
1461
+
1462
+ let(:options) { { 'hosts' => '127.0.0.1:9999', 'data_stream' => 'true' } }
1463
+ let(:es_version) { '8.7.0' } # DS default on LS 8.x
1464
+
1465
+ before do
1466
+ allow(subject).to receive(:discover_cluster_uuid)
1467
+ allow(subject).to receive(:maybe_create_rollover_alias)
1468
+ allow(subject).to receive(:maybe_create_ilm_policy)
1469
+ allow(subject).to receive(:build_client)
1470
+ end
1471
+
1472
+ # this test could not have been done using latches as the fix to the race
1473
+ # condition alters the order of the instructions in elasticsearch.rb
1474
+ #
1475
+ # the race condition happened when the @index was set to the datastream
1476
+ # after `ilm_in_use?` is called but before `setup_ilm`
1477
+ it 'doesn\'t have a race condition leading to resetting back to ILM' do
1478
+ ilm_in_use = subject.method(:ilm_in_use?)
1479
+ expect(subject).to receive(:ilm_in_use?) do |params|
1480
+ ret = ilm_in_use.call
1481
+ sleep 3
1482
+ ret
1483
+ end
1484
+ setup_mapper_and_target = subject.method(:setup_mapper_and_target)
1485
+ expect(subject).to receive(:setup_mapper_and_target).once do |params|
1486
+ sleep 1
1487
+ setup_mapper_and_target.call(params)
1488
+ end
1489
+ subject.register
1490
+ sleep 6
1491
+ expect(subject.index).to eq("logs-generic-default")
1492
+ end
1493
+
1494
+ end
1459
1495
  end
1460
1496
 
1461
1497
  @private
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: 11.15.0
4
+ version: 11.15.1
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-04 00:00:00.000000000 Z
11
+ date: 2023-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -356,7 +356,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
356
356
  - !ruby/object:Gem::Version
357
357
  version: '0'
358
358
  requirements: []
359
- rubygems_version: 3.1.6
359
+ rubygems_version: 3.2.29
360
360
  signing_key:
361
361
  specification_version: 4
362
362
  summary: Stores logs in Elasticsearch