logstash-output-elasticsearch 11.22.0-java → 11.22.1-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
  SHA256:
3
- metadata.gz: 717e2454d150e9f3ae5c7ad9a7cd6d7e4e4451f538e276c1fa1e42a0b6c37f71
4
- data.tar.gz: 714e7b7df621a80edd1a0e3eb0978b7a5b8a3789b2652e76c3336fcf8b7a6dfe
3
+ metadata.gz: 343fd4ddc3b4bef5b44a75dab05e92e88e745d4ed45c8bac1a1264c49ebea26c
4
+ data.tar.gz: 4db3cccc3c815d076ea5d060735934faedb903dd546fd812db9dfcb51b420815
5
5
  SHA512:
6
- metadata.gz: 4d84c7f34a39b0566770881161f50c41f1270ab94131d6d70a35f4264a8e32631ac2da4e607dc61acc565b8e2ab87ca539949046233bce135ffc52c2caf6870e
7
- data.tar.gz: b544f8e2e0f577970464e1bf72adda1e10254c361e3c749c0bfd84ca0184e59736d53dc5e6891f8e8369d2cc101a87af661aec90cc3038aaf2261893cf25eba2
6
+ metadata.gz: 106914085af2ec4e9eaab10d765eab7aca2f4967eb33bc76c11c87b6cbe77795a10966c3d314b612913c34fd91d9a7320f1c1f6990e2cc39f610ecd3dbefce0e
7
+ data.tar.gz: 507d0193320fdf5f5e48f3afc983f287bf69a8f122c3e1c05ee9854a203a90fc45ace2a337fd187b8744ac8693a4963e19da4fa11daafc1d0100d4346a29191f
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 11.22.1
2
+ - Fix, avoid to populate `version` and `version_type` attributes when processing integration metadata and datastream is enabled. [#1161](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1161)
3
+
1
4
  ## 11.22.0
2
5
  - Added support for propagating event processing metadata when this output is downstream of an Elastic Integration Filter and configured _without_ explicit `version`, `version_type`, or `routing` directives [#1158](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/1158)
3
6
 
@@ -499,6 +499,16 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
499
499
  params[retry_on_conflict_action_name] = @retry_on_conflict
500
500
  end
501
501
 
502
+ event_control = event.get("[@metadata][_ingest_document]")
503
+ event_version, event_version_type = event_control&.values_at("version", "version_type") rescue nil
504
+
505
+ resolved_version = resolve_version(event, event_version)
506
+ resolved_version_type = resolve_version_type(event, event_version_type)
507
+
508
+ # avoid to add nil valued key-value pairs
509
+ params[:version] = resolved_version unless resolved_version.nil?
510
+ params[:version_type] = resolved_version_type unless resolved_version_type.nil?
511
+
502
512
  EventActionTuple.new(action, params, event)
503
513
  end
504
514
 
@@ -538,7 +548,7 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
538
548
  # @private shared event params factory between index and data_stream mode
539
549
  def common_event_params(event)
540
550
  event_control = event.get("[@metadata][_ingest_document]")
541
- event_id, event_pipeline, event_index, event_routing, event_version, event_version_type = event_control&.values_at("id","pipeline","index", "routing", "version", "version_type") rescue nil
551
+ event_id, event_pipeline, event_index, event_routing = event_control&.values_at("id","pipeline","index", "routing") rescue nil
542
552
 
543
553
  params = {
544
554
  :_id => resolve_document_id(event, event_id),
@@ -554,12 +564,6 @@ class LogStash::Outputs::ElasticSearch < LogStash::Outputs::Base
554
564
  # }
555
565
  params[:pipeline] = target_pipeline unless (target_pipeline.nil? || target_pipeline.empty?)
556
566
 
557
- resolved_version = resolve_version(event, event_version)
558
- resolved_version_type = resolve_version_type(event, event_version_type)
559
- # avoid to add nil valued key-value pairs
560
- params[:version] = resolved_version unless resolved_version.nil?
561
- params[:version_type] = resolved_version_type unless resolved_version_type.nil?
562
-
563
567
  params
564
568
  end
565
569
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-elasticsearch'
3
- s.version = '11.22.0'
3
+ s.version = '11.22.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"
@@ -297,8 +297,19 @@ describe LogStash::Outputs::ElasticSearch do
297
297
  context "when the event contains an integration metadata version" do
298
298
  let(:event) { LogStash::Event.new({"@metadata" => {"_ingest_document" => {"version" => "456"}}}) }
299
299
 
300
- it "event's metadata version is used" do
301
- expect(subject.send(:event_action_tuple, event)[1]).to include(:version => "456")
300
+ context "when datastream settings are NOT configured" do
301
+ it "event's metadata version is used" do
302
+ expect(subject.send(:event_action_tuple, event)[1]).to include(:version => "456")
303
+ end
304
+ end
305
+
306
+ context "when datastream settings are configured" do
307
+ # NOTE: we validate with datastream-specific `data_stream_event_action_tuple`
308
+ let(:event_fields) { super().merge({"data_stream" => {"type" => "logs", "dataset" => "generic", "namespace" => "default"}}) }
309
+
310
+ it "no version is used" do
311
+ expect(subject.send(:data_stream_event_action_tuple, event)[1]).to_not include(:version)
312
+ end
302
313
  end
303
314
  end
304
315
 
@@ -315,8 +326,19 @@ describe LogStash::Outputs::ElasticSearch do
315
326
  context "when the event contains an integration metadata version_type" do
316
327
  let(:event) { LogStash::Event.new({"@metadata" => {"_ingest_document" => {"version_type" => "external"}}}) }
317
328
 
318
- it "plugin's version_type is used" do
319
- expect(subject.send(:event_action_tuple, event)[1]).to include(:version_type => "internal")
329
+ context "when datastream settings are NOT configured" do
330
+ it "plugin's version_type is used" do
331
+ expect(subject.send(:event_action_tuple, event)[1]).to include(:version_type => "internal")
332
+ end
333
+ end
334
+
335
+ context "when datastream settings are configured" do
336
+ # NOTE: we validate with datastream-specific `data_stream_event_action_tuple`
337
+ let(:event_fields) { super().merge({"data_stream" => {"type" => "logs", "dataset" => "generic", "namespace" => "default"}}) }
338
+
339
+ it "no version_type is used" do
340
+ expect(subject.send(:data_stream_event_action_tuple, event)[1]).to_not include(:version_type)
341
+ end
320
342
  end
321
343
  end
322
344
 
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.22.0
4
+ version: 11.22.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-11-16 00:00:00.000000000 Z
11
+ date: 2023-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement