logstash-output-elasticsearch 12.0.1-java → 12.0.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/docs/index.asciidoc +18 -8
- data/lib/logstash/outputs/elasticsearch/data_stream_support.rb +0 -1
- data/lib/logstash/outputs/elasticsearch/http_client/manticore_adapter.rb +1 -4
- data/lib/logstash/outputs/elasticsearch/http_client/pool.rb +12 -19
- data/lib/logstash/outputs/elasticsearch/http_client.rb +25 -24
- data/lib/logstash/outputs/elasticsearch/ilm.rb +1 -11
- data/lib/logstash/outputs/elasticsearch/template_manager.rb +1 -1
- data/lib/logstash/outputs/elasticsearch.rb +10 -45
- data/logstash-output-elasticsearch.gemspec +1 -1
- data/spec/es_spec_helper.rb +1 -5
- data/spec/integration/outputs/compressed_indexing_spec.rb +5 -5
- data/spec/integration/outputs/index_spec.rb +7 -7
- data/spec/integration/outputs/no_es_on_startup_spec.rb +1 -1
- data/spec/integration/outputs/parent_spec.rb +2 -3
- data/spec/integration/outputs/retry_spec.rb +2 -10
- data/spec/integration/outputs/sniffer_spec.rb +5 -40
- data/spec/unit/outputs/elasticsearch/data_stream_support_spec.rb +0 -23
- data/spec/unit/outputs/elasticsearch/http_client/pool_spec.rb +12 -54
- data/spec/unit/outputs/elasticsearch/template_manager_spec.rb +3 -8
- data/spec/unit/outputs/elasticsearch_spec.rb +15 -17
- metadata +2 -8
- data/lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-6x.json +0 -45
- data/lib/logstash/outputs/elasticsearch/templates/ecs-v1/elasticsearch-6x.json +0 -3695
- data/spec/fixtures/_nodes/6x.json +0 -81
- data/spec/fixtures/template-with-policy-es6x.json +0 -48
@@ -286,29 +286,6 @@ describe LogStash::Outputs::ElasticSearch::DataStreamSupport do
|
|
286
286
|
end
|
287
287
|
|
288
288
|
end
|
289
|
-
|
290
|
-
context 'non-compatible ES' do
|
291
|
-
|
292
|
-
let(:es_version) { '6.8.11' }
|
293
|
-
|
294
|
-
it "prints an error (from after_successful_connection thread) on LS 7.x" do
|
295
|
-
change_constant :LOGSTASH_VERSION, '7.12.0' do
|
296
|
-
expect( subject.logger ).to receive(:error).with(/Elasticsearch version does not support data streams/,
|
297
|
-
{:es_version=>"6.8.11"})
|
298
|
-
stub_plugin_register!
|
299
|
-
end
|
300
|
-
end
|
301
|
-
|
302
|
-
it "prints an error (from after_successful_connection thread) on LS 8.0" do
|
303
|
-
change_constant :LOGSTASH_VERSION, '8.0.5' do
|
304
|
-
expect( subject.logger ).to receive(:error).with(/Elasticsearch version does not support data streams/,
|
305
|
-
{:es_version=>"6.8.11"})
|
306
|
-
stub_plugin_register!
|
307
|
-
end
|
308
|
-
end
|
309
|
-
|
310
|
-
end
|
311
|
-
|
312
289
|
end
|
313
290
|
|
314
291
|
describe "auto routing" do
|
@@ -203,29 +203,6 @@ describe LogStash::Outputs::ElasticSearch::HttpClient::Pool do
|
|
203
203
|
let(:ip_address) { "192.168.1.0"}
|
204
204
|
let(:port) { 9200 }
|
205
205
|
|
206
|
-
context 'in Elasticsearch 1.x format' do
|
207
|
-
context 'with host and ip address' do
|
208
|
-
let(:publish_address) { "inet[#{host}/#{ip_address}:#{port}]"}
|
209
|
-
it 'should correctly extract the host' do
|
210
|
-
expect(subject.address_str_to_uri(publish_address)).to eq (LogStash::Util::SafeURI.new("#{host}:#{port}"))
|
211
|
-
end
|
212
|
-
end
|
213
|
-
context 'with ip address' do
|
214
|
-
let(:publish_address) { "inet[/#{ip_address}:#{port}]"}
|
215
|
-
it 'should correctly extract the ip address' do
|
216
|
-
expect(subject.address_str_to_uri(publish_address)).to eq (LogStash::Util::SafeURI.new("#{ip_address}:#{port}"))
|
217
|
-
end
|
218
|
-
end
|
219
|
-
end
|
220
|
-
|
221
|
-
context 'in Elasticsearch 2.x-6.x format' do
|
222
|
-
let(:publish_address) { "#{ip_address}:#{port}"}
|
223
|
-
it 'should correctly extract the ip address' do
|
224
|
-
expect(subject.address_str_to_uri(publish_address)).to eq (LogStash::Util::SafeURI.new("//#{ip_address}:#{port}"))
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
|
-
context 'in Elasticsearch 7.x'
|
229
206
|
context 'with host and ip address' do
|
230
207
|
let(:publish_address) { "#{host}/#{ip_address}:#{port}"}
|
231
208
|
it 'should correctly extract the host' do
|
@@ -367,14 +344,19 @@ describe LogStash::Outputs::ElasticSearch::HttpClient::Pool do
|
|
367
344
|
|
368
345
|
let(:root_response) { MockResponse.new(200, {"tagline" => "You Know, for Search",
|
369
346
|
"version" => {
|
370
|
-
"number" => '
|
371
|
-
"build_flavor" => 'default'}
|
372
|
-
}) }
|
373
|
-
let(:root_response2) { MockResponse.new(200, {"tagline" => "You Know, for Search",
|
374
|
-
"version" => {
|
375
|
-
"number" => '6.0.0',
|
347
|
+
"number" => '7.0.0',
|
376
348
|
"build_flavor" => 'default'}
|
377
349
|
}) }
|
350
|
+
let(:root_response2) { MockResponse.new(200,
|
351
|
+
{
|
352
|
+
"tagline" => "You Know, for Search",
|
353
|
+
"version" => {
|
354
|
+
"number" => '8.0.0',
|
355
|
+
"build_flavor" => 'default'
|
356
|
+
}
|
357
|
+
},
|
358
|
+
{ "x-elastic-product" => "Elasticsearch" }
|
359
|
+
) }
|
378
360
|
|
379
361
|
context "if there are nodes with multiple major versions" do
|
380
362
|
before(:each) do
|
@@ -383,7 +365,7 @@ describe LogStash::Outputs::ElasticSearch::HttpClient::Pool do
|
|
383
365
|
end
|
384
366
|
|
385
367
|
it "picks the largest major version" do
|
386
|
-
expect(subject.maximum_seen_major_version).to eq(
|
368
|
+
expect(subject.maximum_seen_major_version).to eq(8)
|
387
369
|
end
|
388
370
|
end
|
389
371
|
end
|
@@ -542,30 +524,6 @@ describe "#elasticsearch?" do
|
|
542
524
|
end
|
543
525
|
end
|
544
526
|
|
545
|
-
context "when connecting to a cluster with version < 6.0.0" do
|
546
|
-
it "should fail" do
|
547
|
-
resp = MockResponse.new(200, {"version" => { "number" => "5.0.0" }})
|
548
|
-
expect(subject.send(:elasticsearch?, resp)).to be false
|
549
|
-
end
|
550
|
-
end
|
551
|
-
|
552
|
-
context "when connecting to a cluster with version in [6.0.0..7.0.0)" do
|
553
|
-
it "must be successful with valid 'tagline'" do
|
554
|
-
resp = MockResponse.new(200, {"version" => {"number" => "6.5.0"}, "tagline" => "You Know, for Search"} )
|
555
|
-
expect(subject.send(:elasticsearch?, resp)).to be true
|
556
|
-
end
|
557
|
-
|
558
|
-
it "should fail if invalid 'tagline'" do
|
559
|
-
resp = MockResponse.new(200, {"version" => {"number" => "6.5.0"}, "tagline" => "You don't know"} )
|
560
|
-
expect(subject.send(:elasticsearch?, resp)).to be false
|
561
|
-
end
|
562
|
-
|
563
|
-
it "should fail if 'tagline' is not present" do
|
564
|
-
resp = MockResponse.new(200, {"version" => {"number" => "6.5.0"}} )
|
565
|
-
expect(subject.send(:elasticsearch?, resp)).to be false
|
566
|
-
end
|
567
|
-
end
|
568
|
-
|
569
527
|
context "when connecting to a cluster with version in [7.0.0..7.14.0)" do
|
570
528
|
it "must be successful is 'build_flavor' is 'default' and tagline is correct" do
|
571
529
|
resp = MockResponse.new(200, {"version": {"number": "7.5.0", "build_flavor": "default"}, "tagline": "You Know, for Search"} )
|
@@ -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
|
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
|
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
|
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) { [
|
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
|
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
|
-
|
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).
|
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({
|
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({
|
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
|
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
|
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
|
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
|
1677
|
+
end
|
1680
1678
|
|
1681
1679
|
it "logs template install failure" do
|
1682
1680
|
allow(subject).to receive(:discover_cluster_uuid)
|
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.
|
4
|
+
version: 12.0.2
|
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-
|
11
|
+
date: 2025-01-23 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
|
@@ -368,7 +364,6 @@ specification_version: 4
|
|
368
364
|
summary: Stores logs in Elasticsearch
|
369
365
|
test_files:
|
370
366
|
- spec/es_spec_helper.rb
|
371
|
-
- spec/fixtures/_nodes/6x.json
|
372
367
|
- spec/fixtures/_nodes/7x.json
|
373
368
|
- spec/fixtures/htpasswd
|
374
369
|
- spec/fixtures/license_check/active.json
|
@@ -377,7 +372,6 @@ test_files:
|
|
377
372
|
- spec/fixtures/scripts/painless/scripted_update.painless
|
378
373
|
- spec/fixtures/scripts/painless/scripted_update_nested.painless
|
379
374
|
- spec/fixtures/scripts/painless/scripted_upsert.painless
|
380
|
-
- spec/fixtures/template-with-policy-es6x.json
|
381
375
|
- spec/fixtures/template-with-policy-es7x.json
|
382
376
|
- spec/fixtures/template-with-policy-es8x.json
|
383
377
|
- spec/fixtures/test_certs/GENERATED_AT
|
@@ -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
|
-
}
|