logstash-output-elasticsearch 12.0.1-java → 12.0.3-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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/docs/index.asciidoc +18 -8
  4. data/lib/logstash/outputs/elasticsearch/data_stream_support.rb +0 -1
  5. data/lib/logstash/outputs/elasticsearch/http_client/manticore_adapter.rb +1 -4
  6. data/lib/logstash/outputs/elasticsearch/http_client/pool.rb +17 -20
  7. data/lib/logstash/outputs/elasticsearch/http_client.rb +25 -24
  8. data/lib/logstash/outputs/elasticsearch/ilm.rb +1 -11
  9. data/lib/logstash/outputs/elasticsearch/template_manager.rb +1 -1
  10. data/lib/logstash/outputs/elasticsearch.rb +10 -45
  11. data/logstash-output-elasticsearch.gemspec +1 -1
  12. data/spec/es_spec_helper.rb +35 -27
  13. data/spec/integration/outputs/compressed_indexing_spec.rb +5 -5
  14. data/spec/integration/outputs/delete_spec.rb +4 -4
  15. data/spec/integration/outputs/ilm_spec.rb +18 -12
  16. data/spec/integration/outputs/index_spec.rb +7 -7
  17. data/spec/integration/outputs/index_version_spec.rb +7 -7
  18. data/spec/integration/outputs/no_es_on_startup_spec.rb +1 -1
  19. data/spec/integration/outputs/painless_update_spec.rb +11 -10
  20. data/spec/integration/outputs/parent_spec.rb +2 -3
  21. data/spec/integration/outputs/retry_spec.rb +2 -10
  22. data/spec/integration/outputs/sniffer_spec.rb +5 -40
  23. data/spec/integration/outputs/unsupported_actions_spec.rb +15 -10
  24. data/spec/integration/outputs/update_spec.rb +11 -9
  25. data/spec/spec_helper.rb +8 -0
  26. data/spec/unit/outputs/elasticsearch/data_stream_support_spec.rb +0 -23
  27. data/spec/unit/outputs/elasticsearch/http_client/pool_spec.rb +12 -54
  28. data/spec/unit/outputs/elasticsearch/template_manager_spec.rb +3 -8
  29. data/spec/unit/outputs/elasticsearch_spec.rb +15 -17
  30. data/spec/unit/outputs/error_whitelist_spec.rb +0 -1
  31. metadata +2 -12
  32. data/lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-6x.json +0 -45
  33. data/lib/logstash/outputs/elasticsearch/templates/ecs-v1/elasticsearch-6x.json +0 -3695
  34. data/spec/fixtures/_nodes/6x.json +0 -81
  35. data/spec/fixtures/template-with-policy-es6x.json +0 -48
  36. data/spec/support/elasticsearch/api/actions/get_alias.rb +0 -18
  37. data/spec/support/elasticsearch/api/actions/put_alias.rb +0 -24
@@ -4,11 +4,6 @@ require "logstash/outputs/elasticsearch/template_manager"
4
4
  describe LogStash::Outputs::ElasticSearch::TemplateManager do
5
5
 
6
6
  describe ".default_template_path" do
7
- context "elasticsearch 6.x" do
8
- it "chooses the 6x template" do
9
- expect(described_class.default_template_path(6)).to end_with("/templates/ecs-disabled/elasticsearch-6x.json")
10
- end
11
- end
12
7
  context "elasticsearch 7.x" do
13
8
  it "chooses the 7x template" do
14
9
  expect(described_class.default_template_path(7)).to end_with("/templates/ecs-disabled/elasticsearch-7x.json")
@@ -52,7 +47,7 @@ describe LogStash::Outputs::ElasticSearch::TemplateManager do
52
47
  end
53
48
  end
54
49
 
55
- describe "in version < 8" do
50
+ describe "in version 7" do
56
51
  let(:file_path) { described_class.default_template_path(7) }
57
52
  let(:template) { described_class.read_template_file(file_path)}
58
53
 
@@ -96,7 +91,7 @@ describe LogStash::Outputs::ElasticSearch::TemplateManager do
96
91
  describe "with `template_api => 'auto'`" do
97
92
  let(:template_api) { "auto" }
98
93
 
99
- describe "with ES < 8 versions" do
94
+ describe "with ES 7" do
100
95
 
101
96
  it 'resolves legacy index template API compatible setting' do
102
97
  expect(plugin).to receive(:serverless?).and_return(false)
@@ -134,7 +129,7 @@ describe LogStash::Outputs::ElasticSearch::TemplateManager do
134
129
  end
135
130
  end
136
131
 
137
- describe "in version < 8" do
132
+ describe "in version 7" do
138
133
  it "should use legacy template API" do
139
134
  expect(plugin).to receive(:serverless?).and_return(false)
140
135
  expect(plugin).to receive(:maximum_seen_major_version).at_least(:once).and_return(7)
@@ -9,7 +9,7 @@ require 'rspec/collection_matchers'
9
9
  describe LogStash::Outputs::ElasticSearch do
10
10
  subject(:elasticsearch_output_instance) { described_class.new(options) }
11
11
  let(:options) { {} }
12
- let(:maximum_seen_major_version) { [6,7,8].sample }
12
+ let(:maximum_seen_major_version) { [7,8,9].sample }
13
13
 
14
14
  let(:do_register) { true }
15
15
 
@@ -216,13 +216,6 @@ describe LogStash::Outputs::ElasticSearch do
216
216
  expect(subject.send(:get_event_type, LogStash::Event.new("type" => "foo"))).to eql("_doc")
217
217
  end
218
218
  end
219
-
220
- context "for 6.x elasticsearch clusters" do
221
- let(:maximum_seen_major_version) { 6 }
222
- it "should return 'doc'" do
223
- expect(subject.send(:get_event_type, LogStash::Event.new("type" => "foo"))).to eql("doc")
224
- end
225
- end
226
219
  end
227
220
 
228
221
  context "with 'document type set'" do
@@ -694,7 +687,7 @@ describe LogStash::Outputs::ElasticSearch do
694
687
  expect{ subject.register }.to raise_error(LogStash::ConfigurationError, /configured while DLQ is not enabled/)
695
688
  end
696
689
  end
697
- end if LOGSTASH_VERSION > '7.0'
690
+ end
698
691
 
699
692
  describe "#multi_receive" do
700
693
  let(:events) { [double("one"), double("two"), double("three")] }
@@ -915,7 +908,12 @@ describe LogStash::Outputs::ElasticSearch do
915
908
  allow(elasticsearch_output_instance.client.pool).to receive(:post) do |path, params, body|
916
909
  if body.length > max_bytes
917
910
  max_bytes *= 2 # ensure a successful retry
918
- double("Response", :code => 413, :body => "")
911
+ raise ::LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError.new(
912
+ 413,
913
+ "test-url",
914
+ body,
915
+ ""
916
+ )
919
917
  else
920
918
  double("Response", :code => 200, :body => '{"errors":false,"items":[{"index":{"status":200,"result":"created"}}]}')
921
919
  end
@@ -1136,7 +1134,7 @@ describe LogStash::Outputs::ElasticSearch do
1136
1134
  it "should not set the retry_on_conflict parameter when creating an event_action_tuple" do
1137
1135
  allow(subject.client).to receive(:maximum_seen_major_version).and_return(maximum_seen_major_version)
1138
1136
  action, params, event_data = subject.send(:event_action_tuple, event)
1139
- expect(params).not_to include({subject.send(:retry_on_conflict_action_name) => num_retries})
1137
+ expect(params).to_not include({:retry_on_conflict => num_retries})
1140
1138
  end
1141
1139
  end
1142
1140
 
@@ -1145,7 +1143,7 @@ describe LogStash::Outputs::ElasticSearch do
1145
1143
 
1146
1144
  it "should set the retry_on_conflict parameter when creating an event_action_tuple" do
1147
1145
  action, params, event_data = subject.send(:event_action_tuple, event)
1148
- expect(params).to include({subject.send(:retry_on_conflict_action_name) => num_retries})
1146
+ expect(params).to include({:retry_on_conflict => num_retries})
1149
1147
  end
1150
1148
  end
1151
1149
 
@@ -1154,7 +1152,7 @@ describe LogStash::Outputs::ElasticSearch do
1154
1152
 
1155
1153
  it "should set the retry_on_conflict parameter when creating an event_action_tuple" do
1156
1154
  action, params, event_data = subject.send(:event_action_tuple, event)
1157
- expect(params).to include({subject.send(:retry_on_conflict_action_name) => num_retries})
1155
+ expect(params).to include({:retry_on_conflict => num_retries})
1158
1156
  expect(action).to eq("update")
1159
1157
  end
1160
1158
  end
@@ -1318,7 +1316,7 @@ describe LogStash::Outputs::ElasticSearch do
1318
1316
  expect { subject.register }.to raise_error LogStash::ConfigurationError, /cloud_id and hosts/
1319
1317
  end
1320
1318
  end
1321
- end if LOGSTASH_VERSION > '6.0'
1319
+ end
1322
1320
 
1323
1321
  describe "cloud.auth" do
1324
1322
  let(:do_register) { false }
@@ -1359,7 +1357,7 @@ describe LogStash::Outputs::ElasticSearch do
1359
1357
  expect { subject.register }.to raise_error LogStash::ConfigurationError, /Multiple authentication options are specified/
1360
1358
  end
1361
1359
  end
1362
- end if LOGSTASH_VERSION > '6.0'
1360
+ end
1363
1361
 
1364
1362
  context 'handling elasticsearch document-level status meant for the DLQ' do
1365
1363
  let(:es_api_action) { "CUSTOM_ACTION" }
@@ -1498,7 +1496,7 @@ describe LogStash::Outputs::ElasticSearch do
1498
1496
  include_examples "should write event to DLQ"
1499
1497
  end
1500
1498
 
1501
- end if LOGSTASH_VERSION > '7.0'
1499
+ end
1502
1500
  end
1503
1501
 
1504
1502
  describe "custom headers" do
@@ -1676,7 +1674,7 @@ describe LogStash::Outputs::ElasticSearch do
1676
1674
  subject.send :wait_for_successful_connection
1677
1675
 
1678
1676
  expect(logger).to have_received(:error).with(/Unable to retrieve Elasticsearch cluster uuid/i, anything)
1679
- end if LOGSTASH_VERSION >= '7.0.0'
1677
+ end
1680
1678
 
1681
1679
  it "logs template install failure" do
1682
1680
  allow(subject).to receive(:discover_cluster_uuid)
@@ -4,7 +4,6 @@ require_relative "../../../spec/es_spec_helper"
4
4
  describe "whitelisting error types in expected behavior" do
5
5
  let(:template) { '{"template" : "not important, will be updated by :index"}' }
6
6
  let(:event1) { LogStash::Event.new("somevalue" => 100, "@timestamp" => "2014-11-17T20:37:17.223Z") }
7
- let(:action1) { ["index", {:_id=>1, :routing=>nil, :_index=>"logstash-2014.11.17", :_type=> doc_type }, event1] }
8
7
  let(:settings) { {"manage_template" => true, "index" => "logstash-2014.11.17", "template_overwrite" => true, "hosts" => get_host_port() } }
9
8
 
10
9
  subject { LogStash::Outputs::ElasticSearch.new(settings) }
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: 12.0.1
4
+ version: 12.0.3
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-01-14 00:00:00.000000000 Z
11
+ date: 2025-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -263,11 +263,9 @@ files:
263
263
  - lib/logstash/outputs/elasticsearch/ilm.rb
264
264
  - lib/logstash/outputs/elasticsearch/license_checker.rb
265
265
  - lib/logstash/outputs/elasticsearch/template_manager.rb
266
- - lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-6x.json
267
266
  - lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-7x.json
268
267
  - lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-8x.json
269
268
  - lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-9x.json
270
- - lib/logstash/outputs/elasticsearch/templates/ecs-v1/elasticsearch-6x.json
271
269
  - lib/logstash/outputs/elasticsearch/templates/ecs-v1/elasticsearch-7x.json
272
270
  - lib/logstash/outputs/elasticsearch/templates/ecs-v1/elasticsearch-8x.json
273
271
  - lib/logstash/outputs/elasticsearch/templates/ecs-v1/elasticsearch-9x.json
@@ -279,7 +277,6 @@ files:
279
277
  - lib/logstash/plugin_mixins/elasticsearch/noop_license_checker.rb
280
278
  - logstash-output-elasticsearch.gemspec
281
279
  - spec/es_spec_helper.rb
282
- - spec/fixtures/_nodes/6x.json
283
280
  - spec/fixtures/_nodes/7x.json
284
281
  - spec/fixtures/htpasswd
285
282
  - spec/fixtures/license_check/active.json
@@ -288,7 +285,6 @@ files:
288
285
  - spec/fixtures/scripts/painless/scripted_update.painless
289
286
  - spec/fixtures/scripts/painless/scripted_update_nested.painless
290
287
  - spec/fixtures/scripts/painless/scripted_upsert.painless
291
- - spec/fixtures/template-with-policy-es6x.json
292
288
  - spec/fixtures/template-with-policy-es7x.json
293
289
  - spec/fixtures/template-with-policy-es8x.json
294
290
  - spec/fixtures/test_certs/GENERATED_AT
@@ -326,9 +322,7 @@ files:
326
322
  - spec/integration/outputs/update_spec.rb
327
323
  - spec/spec_helper.rb
328
324
  - spec/support/elasticsearch/api/actions/delete_ilm_policy.rb
329
- - spec/support/elasticsearch/api/actions/get_alias.rb
330
325
  - spec/support/elasticsearch/api/actions/get_ilm_policy.rb
331
- - spec/support/elasticsearch/api/actions/put_alias.rb
332
326
  - spec/support/elasticsearch/api/actions/put_ilm_policy.rb
333
327
  - spec/unit/http_client_builder_spec.rb
334
328
  - spec/unit/outputs/elasticsearch/data_stream_support_spec.rb
@@ -368,7 +362,6 @@ specification_version: 4
368
362
  summary: Stores logs in Elasticsearch
369
363
  test_files:
370
364
  - spec/es_spec_helper.rb
371
- - spec/fixtures/_nodes/6x.json
372
365
  - spec/fixtures/_nodes/7x.json
373
366
  - spec/fixtures/htpasswd
374
367
  - spec/fixtures/license_check/active.json
@@ -377,7 +370,6 @@ test_files:
377
370
  - spec/fixtures/scripts/painless/scripted_update.painless
378
371
  - spec/fixtures/scripts/painless/scripted_update_nested.painless
379
372
  - spec/fixtures/scripts/painless/scripted_upsert.painless
380
- - spec/fixtures/template-with-policy-es6x.json
381
373
  - spec/fixtures/template-with-policy-es7x.json
382
374
  - spec/fixtures/template-with-policy-es8x.json
383
375
  - spec/fixtures/test_certs/GENERATED_AT
@@ -415,9 +407,7 @@ test_files:
415
407
  - spec/integration/outputs/update_spec.rb
416
408
  - spec/spec_helper.rb
417
409
  - spec/support/elasticsearch/api/actions/delete_ilm_policy.rb
418
- - spec/support/elasticsearch/api/actions/get_alias.rb
419
410
  - spec/support/elasticsearch/api/actions/get_ilm_policy.rb
420
- - spec/support/elasticsearch/api/actions/put_alias.rb
421
411
  - spec/support/elasticsearch/api/actions/put_ilm_policy.rb
422
412
  - spec/unit/http_client_builder_spec.rb
423
413
  - spec/unit/outputs/elasticsearch/data_stream_support_spec.rb
@@ -1,45 +0,0 @@
1
- {
2
- "template" : "logstash-*",
3
- "version" : 60001,
4
- "settings" : {
5
- "index.refresh_interval" : "5s"
6
- },
7
- "mappings" : {
8
- "_default_" : {
9
- "dynamic_templates" : [ {
10
- "message_field" : {
11
- "path_match" : "message",
12
- "match_mapping_type" : "string",
13
- "mapping" : {
14
- "type" : "text",
15
- "norms" : false
16
- }
17
- }
18
- }, {
19
- "string_fields" : {
20
- "match" : "*",
21
- "match_mapping_type" : "string",
22
- "mapping" : {
23
- "type" : "text", "norms" : false,
24
- "fields" : {
25
- "keyword" : { "type": "keyword", "ignore_above": 256 }
26
- }
27
- }
28
- }
29
- } ],
30
- "properties" : {
31
- "@timestamp": { "type": "date"},
32
- "@version": { "type": "keyword"},
33
- "geoip" : {
34
- "dynamic": true,
35
- "properties" : {
36
- "ip": { "type": "ip" },
37
- "location" : { "type" : "geo_point" },
38
- "latitude" : { "type" : "half_float" },
39
- "longitude" : { "type" : "half_float" }
40
- }
41
- }
42
- }
43
- }
44
- }
45
- }