logstash-output-elasticsearch 11.0.2-java → 11.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 +4 -4
- data/CHANGELOG.md +12 -0
- data/docs/index.asciidoc +11 -11
- data/lib/logstash/outputs/elasticsearch/http_client/pool.rb +2 -28
- data/lib/logstash/outputs/elasticsearch/http_client.rb +19 -0
- data/lib/logstash/outputs/elasticsearch/ilm.rb +2 -33
- data/lib/logstash/outputs/elasticsearch/template_manager.rb +1 -1
- data/lib/logstash/outputs/elasticsearch.rb +3 -14
- data/lib/logstash/plugin_mixins/elasticsearch/common.rb +5 -1
- data/logstash-output-elasticsearch.gemspec +3 -2
- data/spec/es_spec_helper.rb +14 -7
- data/spec/fixtures/_nodes/{5x_6x.json → 6x.json} +5 -5
- data/spec/integration/outputs/compressed_indexing_spec.rb +47 -46
- data/spec/integration/outputs/delete_spec.rb +49 -51
- data/spec/integration/outputs/ilm_spec.rb +230 -246
- data/spec/integration/outputs/index_spec.rb +5 -2
- data/spec/integration/outputs/index_version_spec.rb +78 -82
- data/spec/integration/outputs/ingest_pipeline_spec.rb +58 -60
- data/spec/integration/outputs/no_es_on_startup_spec.rb +14 -0
- data/spec/integration/outputs/painless_update_spec.rb +74 -164
- data/spec/integration/outputs/parent_spec.rb +67 -75
- data/spec/integration/outputs/retry_spec.rb +2 -2
- data/spec/integration/outputs/sniffer_spec.rb +15 -53
- data/spec/integration/outputs/templates_spec.rb +79 -81
- data/spec/integration/outputs/update_spec.rb +99 -101
- data/spec/spec_helper.rb +1 -5
- data/spec/unit/outputs/elasticsearch/data_stream_support_spec.rb +0 -14
- data/spec/unit/outputs/elasticsearch/http_client/pool_spec.rb +30 -37
- data/spec/unit/outputs/elasticsearch/http_client_spec.rb +69 -0
- data/spec/unit/outputs/elasticsearch/template_manager_spec.rb +9 -9
- data/spec/unit/outputs/elasticsearch_spec.rb +2 -8
- data/spec/unit/outputs/error_whitelist_spec.rb +1 -0
- metadata +21 -24
- data/lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-2x.json +0 -95
- data/lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-5x.json +0 -46
- data/lib/logstash/outputs/elasticsearch/templates/ecs-v1/elasticsearch-6x.json +0 -2950
- data/lib/logstash/outputs/elasticsearch/templates/ecs-v1/elasticsearch-7x.json +0 -2948
- data/spec/fixtures/_nodes/2x_1x.json +0 -27
- data/spec/fixtures/scripts/groovy/scripted_update.groovy +0 -2
- data/spec/fixtures/scripts/groovy/scripted_update_nested.groovy +0 -2
- data/spec/fixtures/scripts/groovy/scripted_upsert.groovy +0 -2
- data/spec/integration/outputs/groovy_update_spec.rb +0 -150
- data/spec/integration/outputs/templates_5x_spec.rb +0 -98
@@ -1,116 +1,114 @@
|
|
1
1
|
require_relative "../../../spec/es_spec_helper"
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
3
|
+
describe "Update actions without scripts", :integration => true do
|
4
|
+
require "logstash/outputs/elasticsearch"
|
5
|
+
|
6
|
+
def get_es_output( options={} )
|
7
|
+
settings = {
|
8
|
+
"manage_template" => true,
|
9
|
+
"index" => "logstash-update",
|
10
|
+
"template_overwrite" => true,
|
11
|
+
"hosts" => get_host_port(),
|
12
|
+
"action" => "update"
|
13
|
+
}
|
14
|
+
LogStash::Outputs::ElasticSearch.new(settings.merge!(options))
|
15
|
+
end
|
16
|
+
|
17
|
+
before :each do
|
18
|
+
@es = get_client
|
19
|
+
# Delete all templates first.
|
20
|
+
# Clean ES of data before we start.
|
21
|
+
@es.indices.delete_template(:name => "*")
|
22
|
+
# This can fail if there are no indexes, ignore failure.
|
23
|
+
@es.indices.delete(:index => "*") rescue nil
|
24
|
+
@es.index(
|
25
|
+
:index => 'logstash-update',
|
26
|
+
:type => doc_type,
|
27
|
+
:id => "123",
|
28
|
+
:body => { :message => 'Test', :counter => 1 }
|
29
|
+
)
|
30
|
+
@es.indices.refresh
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should fail without a document_id" do
|
34
|
+
subject = get_es_output
|
35
|
+
expect { subject.register }.to raise_error(LogStash::ConfigurationError)
|
36
|
+
end
|
37
|
+
|
38
|
+
context "when update only" do
|
39
|
+
it "should not create new document" do
|
40
|
+
subject = get_es_output({ 'document_id' => "456" } )
|
41
|
+
subject.register
|
42
|
+
subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
|
43
|
+
expect {@es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)}.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should update existing document" do
|
47
|
+
subject = get_es_output({ 'document_id' => "123" })
|
48
|
+
subject.register
|
49
|
+
subject.multi_receive([LogStash::Event.new("message" => "updated message here")])
|
50
|
+
r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "123", :refresh => true)
|
51
|
+
expect(r["_source"]["message"]).to eq('updated message here')
|
52
|
+
end
|
53
|
+
|
54
|
+
# The es ruby client treats the data field differently. Make sure this doesn't
|
55
|
+
# raise an exception
|
56
|
+
it "should update an existing document that has a 'data' field" do
|
57
|
+
subject = get_es_output({ 'document_id' => "123" })
|
58
|
+
subject.register
|
59
|
+
subject.multi_receive([LogStash::Event.new("data" => "updated message here", "message" => "foo")])
|
60
|
+
r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "123", :refresh => true)
|
61
|
+
expect(r["_source"]["data"]).to eq('updated message here')
|
62
|
+
expect(r["_source"]["message"]).to eq('foo')
|
63
|
+
end
|
64
|
+
|
65
|
+
it "should allow default (internal) version" do
|
66
|
+
subject = get_es_output({ 'document_id' => "123", "version" => "99" })
|
67
|
+
subject.register
|
16
68
|
end
|
17
69
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
# Clean ES of data before we start.
|
22
|
-
@es.indices.delete_template(:name => "*")
|
23
|
-
# This can fail if there are no indexes, ignore failure.
|
24
|
-
@es.indices.delete(:index => "*") rescue nil
|
25
|
-
@es.index(
|
26
|
-
:index => 'logstash-update',
|
27
|
-
:type => doc_type,
|
28
|
-
:id => "123",
|
29
|
-
:body => { :message => 'Test', :counter => 1 }
|
30
|
-
)
|
31
|
-
@es.indices.refresh
|
70
|
+
it "should allow internal version" do
|
71
|
+
subject = get_es_output({ 'document_id' => "123", "version" => "99", "version_type" => "internal" })
|
72
|
+
subject.register
|
32
73
|
end
|
33
74
|
|
34
|
-
it "should
|
35
|
-
subject = get_es_output
|
75
|
+
it "should not allow external version" do
|
76
|
+
subject = get_es_output({ 'document_id' => "123", "version" => "99", "version_type" => "external" })
|
36
77
|
expect { subject.register }.to raise_error(LogStash::ConfigurationError)
|
37
78
|
end
|
38
79
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
|
44
|
-
expect {@es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)}.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
|
45
|
-
end
|
46
|
-
|
47
|
-
it "should update existing document" do
|
48
|
-
subject = get_es_output({ 'document_id' => "123" })
|
49
|
-
subject.register
|
50
|
-
subject.multi_receive([LogStash::Event.new("message" => "updated message here")])
|
51
|
-
r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "123", :refresh => true)
|
52
|
-
expect(r["_source"]["message"]).to eq('updated message here')
|
53
|
-
end
|
54
|
-
|
55
|
-
# The es ruby client treats the data field differently. Make sure this doesn't
|
56
|
-
# raise an exception
|
57
|
-
it "should update an existing document that has a 'data' field" do
|
58
|
-
subject = get_es_output({ 'document_id' => "123" })
|
59
|
-
subject.register
|
60
|
-
subject.multi_receive([LogStash::Event.new("data" => "updated message here", "message" => "foo")])
|
61
|
-
r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "123", :refresh => true)
|
62
|
-
expect(r["_source"]["data"]).to eq('updated message here')
|
63
|
-
expect(r["_source"]["message"]).to eq('foo')
|
64
|
-
end
|
65
|
-
|
66
|
-
it "should allow default (internal) version" do
|
67
|
-
subject = get_es_output({ 'document_id' => "123", "version" => "99" })
|
68
|
-
subject.register
|
69
|
-
end
|
70
|
-
|
71
|
-
it "should allow internal version" do
|
72
|
-
subject = get_es_output({ 'document_id' => "123", "version" => "99", "version_type" => "internal" })
|
73
|
-
subject.register
|
74
|
-
end
|
75
|
-
|
76
|
-
it "should not allow external version" do
|
77
|
-
subject = get_es_output({ 'document_id' => "123", "version" => "99", "version_type" => "external" })
|
78
|
-
expect { subject.register }.to raise_error(LogStash::ConfigurationError)
|
79
|
-
end
|
80
|
-
|
81
|
-
it "should not allow external_gt version" do
|
82
|
-
subject = get_es_output({ 'document_id' => "123", "version" => "99", "version_type" => "external_gt" })
|
83
|
-
expect { subject.register }.to raise_error(LogStash::ConfigurationError)
|
84
|
-
end
|
85
|
-
|
86
|
-
it "should not allow external_gte version" do
|
87
|
-
subject = get_es_output({ 'document_id' => "123", "version" => "99", "version_type" => "external_gte" })
|
88
|
-
expect { subject.register }.to raise_error(LogStash::ConfigurationError)
|
89
|
-
end
|
80
|
+
it "should not allow external_gt version" do
|
81
|
+
subject = get_es_output({ 'document_id' => "123", "version" => "99", "version_type" => "external_gt" })
|
82
|
+
expect { subject.register }.to raise_error(LogStash::ConfigurationError)
|
83
|
+
end
|
90
84
|
|
85
|
+
it "should not allow external_gte version" do
|
86
|
+
subject = get_es_output({ 'document_id' => "123", "version" => "99", "version_type" => "external_gte" })
|
87
|
+
expect { subject.register }.to raise_error(LogStash::ConfigurationError)
|
91
88
|
end
|
92
89
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
90
|
+
end
|
91
|
+
|
92
|
+
context "when update with upsert" do
|
93
|
+
it "should create new documents with provided upsert" do
|
94
|
+
subject = get_es_output({ 'document_id' => "456", 'upsert' => '{"message": "upsert message"}' })
|
95
|
+
subject.register
|
96
|
+
subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
|
97
|
+
r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
|
98
|
+
expect(r["_source"]["message"]).to eq('upsert message')
|
99
|
+
end
|
100
|
+
|
101
|
+
it "should create new documents with event/doc as upsert" do
|
102
|
+
subject = get_es_output({ 'document_id' => "456", 'doc_as_upsert' => true })
|
103
|
+
subject.register
|
104
|
+
subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
|
105
|
+
r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
|
106
|
+
expect(r["_source"]["message"]).to eq('sample message here')
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should fail on documents with event/doc as upsert at external version" do
|
110
|
+
subject = get_es_output({ 'document_id' => "456", 'doc_as_upsert' => true, 'version' => 999, "version_type" => "external" })
|
111
|
+
expect { subject.register }.to raise_error(LogStash::ConfigurationError)
|
114
112
|
end
|
115
113
|
end
|
116
114
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,9 +1,5 @@
|
|
1
1
|
require "logstash/devutils/rspec/spec_helper"
|
2
2
|
|
3
|
-
unless defined?(LogStash::OSS)
|
4
|
-
LogStash::OSS = ENV['DISTRIBUTION'] != "default"
|
5
|
-
end
|
6
|
-
|
7
3
|
require "logstash/outputs/elasticsearch"
|
8
4
|
|
9
5
|
module LogStash::Outputs::ElasticSearch::SpecHelper
|
@@ -11,4 +7,4 @@ end
|
|
11
7
|
|
12
8
|
RSpec.configure do |config|
|
13
9
|
config.include LogStash::Outputs::ElasticSearch::SpecHelper
|
14
|
-
end
|
10
|
+
end
|
@@ -31,18 +31,12 @@ describe LogStash::Outputs::ElasticSearch::DataStreamSupport do
|
|
31
31
|
# end
|
32
32
|
end
|
33
33
|
|
34
|
-
@@logstash_oss = LogStash::OSS
|
35
|
-
|
36
34
|
before(:each) do
|
37
|
-
change_constant :OSS, false, target: LogStash # assume non-OSS by default
|
38
|
-
|
39
35
|
stub_plugin_register! if do_register
|
40
36
|
end
|
41
37
|
|
42
38
|
after(:each) do
|
43
39
|
subject.close if do_register
|
44
|
-
|
45
|
-
change_constant :OSS, @@logstash_oss, target: LogStash
|
46
40
|
end
|
47
41
|
|
48
42
|
context "default configuration" do
|
@@ -115,14 +109,6 @@ describe LogStash::Outputs::ElasticSearch::DataStreamSupport do
|
|
115
109
|
end
|
116
110
|
end
|
117
111
|
|
118
|
-
it "uses data-streams on LS 8.0 (OSS)" do
|
119
|
-
change_constant :LOGSTASH_VERSION, '8.0.1' do
|
120
|
-
change_constant :OSS, true, target: LogStash do
|
121
|
-
expect( subject.data_stream_config? ).to be true
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
112
|
context 'old ES' do
|
127
113
|
|
128
114
|
let(:es_version) { '7.8.1' }
|
@@ -8,15 +8,12 @@ describe LogStash::Outputs::ElasticSearch::HttpClient::Pool do
|
|
8
8
|
let(:initial_urls) { [::LogStash::Util::SafeURI.new("http://localhost:9200")] }
|
9
9
|
let(:options) { {:resurrect_delay => 2, :url_normalizer => proc {|u| u}} } # Shorten the delay a bit to speed up tests
|
10
10
|
let(:es_node_versions) { [ "0.0.0" ] }
|
11
|
-
let(:oss) { true }
|
12
11
|
let(:license_status) { 'active' }
|
13
12
|
|
14
13
|
subject { described_class.new(logger, adapter, initial_urls, options) }
|
15
14
|
|
16
15
|
let(:manticore_double) { double("manticore a") }
|
17
16
|
before(:each) do
|
18
|
-
stub_const('LogStash::OSS', oss)
|
19
|
-
|
20
17
|
response_double = double("manticore response").as_null_object
|
21
18
|
# Allow healtchecks
|
22
19
|
allow(manticore_double).to receive(:head).with(any_args).and_return(response_double)
|
@@ -278,50 +275,46 @@ describe LogStash::Outputs::ElasticSearch::HttpClient::Pool do
|
|
278
275
|
allow(subject).to receive(:health_check_request)
|
279
276
|
end
|
280
277
|
|
281
|
-
context "
|
282
|
-
let(:
|
283
|
-
|
284
|
-
context "if ES doesn't return a valid license" do
|
285
|
-
let(:license_status) { nil }
|
278
|
+
context "if ES doesn't return a valid license" do
|
279
|
+
let(:license_status) { nil }
|
286
280
|
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
281
|
+
it "marks the url as dead" do
|
282
|
+
subject.update_initial_urls
|
283
|
+
expect(subject.alive_urls_count).to eq(0)
|
284
|
+
end
|
291
285
|
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
end
|
286
|
+
it "logs a warning" do
|
287
|
+
expect(subject.license_checker).to receive(:warn_no_license).once.and_call_original
|
288
|
+
subject.update_initial_urls
|
296
289
|
end
|
290
|
+
end
|
297
291
|
|
298
|
-
|
299
|
-
|
292
|
+
context "if ES returns a valid license" do
|
293
|
+
let(:license_status) { 'active' }
|
300
294
|
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
295
|
+
it "marks the url as active" do
|
296
|
+
subject.update_initial_urls
|
297
|
+
expect(subject.alive_urls_count).to eq(1)
|
298
|
+
end
|
305
299
|
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
end
|
300
|
+
it "does not log a warning" do
|
301
|
+
expect(subject.license_checker).to_not receive(:warn_no_license)
|
302
|
+
expect(subject.license_checker).to_not receive(:warn_invalid_license)
|
303
|
+
subject.update_initial_urls
|
311
304
|
end
|
305
|
+
end
|
312
306
|
|
313
|
-
|
314
|
-
|
307
|
+
context "if ES returns an invalid license" do
|
308
|
+
let(:license_status) { 'invalid' }
|
315
309
|
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
310
|
+
it "marks the url as active" do
|
311
|
+
subject.update_initial_urls
|
312
|
+
expect(subject.alive_urls_count).to eq(1)
|
313
|
+
end
|
320
314
|
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
end
|
315
|
+
it "logs a warning" do
|
316
|
+
expect(subject.license_checker).to receive(:warn_invalid_license).and_call_original
|
317
|
+
subject.update_initial_urls
|
325
318
|
end
|
326
319
|
end
|
327
320
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require_relative "../../../../spec/spec_helper"
|
2
2
|
require "logstash/outputs/elasticsearch/http_client"
|
3
3
|
require "cabin"
|
4
|
+
require "webrick"
|
5
|
+
require "java"
|
4
6
|
|
5
7
|
describe LogStash::Outputs::ElasticSearch::HttpClient do
|
6
8
|
let(:ssl) { nil }
|
@@ -287,4 +289,71 @@ describe LogStash::Outputs::ElasticSearch::HttpClient do
|
|
287
289
|
end
|
288
290
|
end
|
289
291
|
end
|
292
|
+
|
293
|
+
class StoppableServer
|
294
|
+
|
295
|
+
attr_reader :port
|
296
|
+
|
297
|
+
def initialize()
|
298
|
+
queue = Queue.new
|
299
|
+
@first_req_waiter = java.util.concurrent.CountDownLatch.new(1)
|
300
|
+
@first_request = nil
|
301
|
+
|
302
|
+
@t = java.lang.Thread.new(
|
303
|
+
proc do
|
304
|
+
begin
|
305
|
+
@server = WEBrick::HTTPServer.new :Port => 0, :DocumentRoot => ".",
|
306
|
+
:Logger => Cabin::Channel.get, # silence WEBrick logging
|
307
|
+
:StartCallback => Proc.new {
|
308
|
+
queue.push("started")
|
309
|
+
}
|
310
|
+
@port = @server.config[:Port]
|
311
|
+
@server.mount_proc '/headers_check' do |req, res|
|
312
|
+
res.body = 'Hello, world from WEBrick mocking server!'
|
313
|
+
@first_request = req
|
314
|
+
@first_req_waiter.countDown()
|
315
|
+
end
|
316
|
+
|
317
|
+
@server.start
|
318
|
+
rescue => e
|
319
|
+
puts "Error in webserver thread #{e}"
|
320
|
+
# ignore
|
321
|
+
end
|
322
|
+
end
|
323
|
+
)
|
324
|
+
@t.daemon = true
|
325
|
+
@t.start
|
326
|
+
queue.pop # blocks until the server is up
|
327
|
+
end
|
328
|
+
|
329
|
+
def stop
|
330
|
+
@server.shutdown
|
331
|
+
end
|
332
|
+
|
333
|
+
def wait_receive_request
|
334
|
+
@first_req_waiter.await(2, java.util.concurrent.TimeUnit::SECONDS)
|
335
|
+
@first_request
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
339
|
+
describe "#build_adapter" do
|
340
|
+
let(:client) { LogStash::Outputs::ElasticSearch::HttpClient.new(base_options) }
|
341
|
+
let!(:webserver) { StoppableServer.new } # webserver must be started before the call, so no lazy "let"
|
342
|
+
|
343
|
+
after :each do
|
344
|
+
webserver.stop
|
345
|
+
end
|
346
|
+
|
347
|
+
context "the 'user-agent' header" do
|
348
|
+
it "contains the Logstash environment details" do
|
349
|
+
adapter = client.build_adapter(client.options)
|
350
|
+
adapter.perform_request(::LogStash::Util::SafeURI.new("http://localhost:#{webserver.port}"), :get, "/headers_check")
|
351
|
+
|
352
|
+
request = webserver.wait_receive_request
|
353
|
+
|
354
|
+
transmitted_user_agent = request.header['user-agent'][0]
|
355
|
+
expect(transmitted_user_agent).to match(/Logstash\/\d*\.\d*\.\d* \(OS=.*; JVM=.*\) logstash-output-elasticsearch\/\d*\.\d*\.\d*/)
|
356
|
+
end
|
357
|
+
end
|
358
|
+
end
|
290
359
|
end
|
@@ -4,19 +4,19 @@ 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
|
8
|
-
it "chooses the
|
9
|
-
expect(described_class.default_template_path(
|
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
10
|
end
|
11
11
|
end
|
12
|
-
context "elasticsearch
|
13
|
-
it "chooses the
|
14
|
-
expect(described_class.default_template_path(
|
12
|
+
context "elasticsearch 7.x" do
|
13
|
+
it "chooses the 7x template" do
|
14
|
+
expect(described_class.default_template_path(7)).to end_with("/templates/ecs-disabled/elasticsearch-7x.json")
|
15
15
|
end
|
16
16
|
end
|
17
|
-
context "elasticsearch
|
18
|
-
it "chooses the
|
19
|
-
expect(described_class.default_template_path(
|
17
|
+
context "elasticsearch 8.x" do
|
18
|
+
it "chooses the 8x template" do
|
19
|
+
expect(described_class.default_template_path(8)).to end_with("/templates/ecs-disabled/elasticsearch-8x.json")
|
20
20
|
end
|
21
21
|
end
|
22
22
|
end
|
@@ -7,7 +7,7 @@ require "logstash/outputs/elasticsearch"
|
|
7
7
|
describe LogStash::Outputs::ElasticSearch do
|
8
8
|
subject(:elasticsearch_output_instance) { described_class.new(options) }
|
9
9
|
let(:options) { {} }
|
10
|
-
let(:maximum_seen_major_version) { [
|
10
|
+
let(:maximum_seen_major_version) { [6,7,8].sample }
|
11
11
|
|
12
12
|
let(:do_register) { true }
|
13
13
|
|
@@ -79,13 +79,6 @@ describe LogStash::Outputs::ElasticSearch do
|
|
79
79
|
expect(subject.send(:get_event_type, LogStash::Event.new("type" => "foo"))).to eql("doc")
|
80
80
|
end
|
81
81
|
end
|
82
|
-
|
83
|
-
context "for < 6.0 elasticsearch clusters" do
|
84
|
-
let(:maximum_seen_major_version) { 5 }
|
85
|
-
it "should get the type from the event" do
|
86
|
-
expect(subject.send(:get_event_type, LogStash::Event.new("type" => "foo"))).to eql("foo")
|
87
|
-
end
|
88
|
-
end
|
89
82
|
end
|
90
83
|
|
91
84
|
context "with 'document type set'" do
|
@@ -941,6 +934,7 @@ describe LogStash::Outputs::ElasticSearch do
|
|
941
934
|
allow(subject).to receive(:last_es_version).and_return es_version
|
942
935
|
# make successful_connection? return true:
|
943
936
|
allow(subject).to receive(:maximum_seen_major_version).and_return Integer(es_version.split('.').first)
|
937
|
+
allow(subject).to receive(:alive_urls_count).and_return Integer(1)
|
944
938
|
allow(subject).to receive(:stop_after_successful_connection_thread)
|
945
939
|
end
|
946
940
|
|
@@ -12,6 +12,7 @@ describe "whitelisting error types in expected behavior" do
|
|
12
12
|
before :each do
|
13
13
|
allow(subject.logger).to receive(:warn)
|
14
14
|
allow(subject).to receive(:maximum_seen_major_version).and_return(0)
|
15
|
+
allow(subject).to receive(:alive_urls_count).and_return(1)
|
15
16
|
allow(subject).to receive(:finish_register)
|
16
17
|
|
17
18
|
subject.register
|
metadata
CHANGED
@@ -1,21 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-output-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 11.0
|
4
|
+
version: 11.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: 2021-
|
11
|
+
date: 2021-09-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
15
15
|
requirements:
|
16
16
|
- - ">="
|
17
17
|
- !ruby/object:Gem::Version
|
18
|
-
version: 0.
|
18
|
+
version: 0.7.1
|
19
19
|
- - "<"
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 1.0.0
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 0.
|
29
|
+
version: 0.7.1
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 1.0.0
|
@@ -140,6 +140,20 @@ dependencies:
|
|
140
140
|
- - "~>"
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0.6'
|
143
|
+
- !ruby/object:Gem::Dependency
|
144
|
+
requirement: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
name: webrick
|
150
|
+
prerelease: false
|
151
|
+
type: :development
|
152
|
+
version_requirements: !ruby/object:Gem::Requirement
|
153
|
+
requirements:
|
154
|
+
- - ">="
|
155
|
+
- !ruby/object:Gem::Version
|
156
|
+
version: '0'
|
143
157
|
- !ruby/object:Gem::Dependency
|
144
158
|
requirement: !ruby/object:Gem::Requirement
|
145
159
|
requirements:
|
@@ -179,26 +193,18 @@ files:
|
|
179
193
|
- lib/logstash/outputs/elasticsearch/ilm.rb
|
180
194
|
- lib/logstash/outputs/elasticsearch/license_checker.rb
|
181
195
|
- lib/logstash/outputs/elasticsearch/template_manager.rb
|
182
|
-
- lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-2x.json
|
183
|
-
- lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-5x.json
|
184
196
|
- lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-6x.json
|
185
197
|
- lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-7x.json
|
186
198
|
- lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-8x.json
|
187
|
-
- lib/logstash/outputs/elasticsearch/templates/ecs-v1/elasticsearch-6x.json
|
188
|
-
- lib/logstash/outputs/elasticsearch/templates/ecs-v1/elasticsearch-7x.json
|
189
199
|
- lib/logstash/plugin_mixins/elasticsearch/api_configs.rb
|
190
200
|
- lib/logstash/plugin_mixins/elasticsearch/common.rb
|
191
201
|
- lib/logstash/plugin_mixins/elasticsearch/noop_license_checker.rb
|
192
202
|
- logstash-output-elasticsearch.gemspec
|
193
203
|
- spec/es_spec_helper.rb
|
194
|
-
- spec/fixtures/_nodes/
|
195
|
-
- spec/fixtures/_nodes/5x_6x.json
|
204
|
+
- spec/fixtures/_nodes/6x.json
|
196
205
|
- spec/fixtures/_nodes/7x.json
|
197
206
|
- spec/fixtures/htpasswd
|
198
207
|
- spec/fixtures/nginx_reverse_proxy.conf
|
199
|
-
- spec/fixtures/scripts/groovy/scripted_update.groovy
|
200
|
-
- spec/fixtures/scripts/groovy/scripted_update_nested.groovy
|
201
|
-
- spec/fixtures/scripts/groovy/scripted_upsert.groovy
|
202
208
|
- spec/fixtures/scripts/painless/scripted_update.painless
|
203
209
|
- spec/fixtures/scripts/painless/scripted_update_nested.painless
|
204
210
|
- spec/fixtures/scripts/painless/scripted_upsert.painless
|
@@ -213,7 +219,6 @@ files:
|
|
213
219
|
- spec/integration/outputs/create_spec.rb
|
214
220
|
- spec/integration/outputs/data_stream_spec.rb
|
215
221
|
- spec/integration/outputs/delete_spec.rb
|
216
|
-
- spec/integration/outputs/groovy_update_spec.rb
|
217
222
|
- spec/integration/outputs/ilm_spec.rb
|
218
223
|
- spec/integration/outputs/index_spec.rb
|
219
224
|
- spec/integration/outputs/index_version_spec.rb
|
@@ -225,7 +230,6 @@ files:
|
|
225
230
|
- spec/integration/outputs/retry_spec.rb
|
226
231
|
- spec/integration/outputs/routing_spec.rb
|
227
232
|
- spec/integration/outputs/sniffer_spec.rb
|
228
|
-
- spec/integration/outputs/templates_5x_spec.rb
|
229
233
|
- spec/integration/outputs/templates_spec.rb
|
230
234
|
- spec/integration/outputs/update_spec.rb
|
231
235
|
- spec/spec_helper.rb
|
@@ -266,21 +270,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
266
270
|
- !ruby/object:Gem::Version
|
267
271
|
version: '0'
|
268
272
|
requirements: []
|
269
|
-
|
270
|
-
rubygems_version: 2.6.13
|
273
|
+
rubygems_version: 3.1.6
|
271
274
|
signing_key:
|
272
275
|
specification_version: 4
|
273
276
|
summary: Stores logs in Elasticsearch
|
274
277
|
test_files:
|
275
278
|
- spec/es_spec_helper.rb
|
276
|
-
- spec/fixtures/_nodes/
|
277
|
-
- spec/fixtures/_nodes/5x_6x.json
|
279
|
+
- spec/fixtures/_nodes/6x.json
|
278
280
|
- spec/fixtures/_nodes/7x.json
|
279
281
|
- spec/fixtures/htpasswd
|
280
282
|
- spec/fixtures/nginx_reverse_proxy.conf
|
281
|
-
- spec/fixtures/scripts/groovy/scripted_update.groovy
|
282
|
-
- spec/fixtures/scripts/groovy/scripted_update_nested.groovy
|
283
|
-
- spec/fixtures/scripts/groovy/scripted_upsert.groovy
|
284
283
|
- spec/fixtures/scripts/painless/scripted_update.painless
|
285
284
|
- spec/fixtures/scripts/painless/scripted_update_nested.painless
|
286
285
|
- spec/fixtures/scripts/painless/scripted_upsert.painless
|
@@ -295,7 +294,6 @@ test_files:
|
|
295
294
|
- spec/integration/outputs/create_spec.rb
|
296
295
|
- spec/integration/outputs/data_stream_spec.rb
|
297
296
|
- spec/integration/outputs/delete_spec.rb
|
298
|
-
- spec/integration/outputs/groovy_update_spec.rb
|
299
297
|
- spec/integration/outputs/ilm_spec.rb
|
300
298
|
- spec/integration/outputs/index_spec.rb
|
301
299
|
- spec/integration/outputs/index_version_spec.rb
|
@@ -307,7 +305,6 @@ test_files:
|
|
307
305
|
- spec/integration/outputs/retry_spec.rb
|
308
306
|
- spec/integration/outputs/routing_spec.rb
|
309
307
|
- spec/integration/outputs/sniffer_spec.rb
|
310
|
-
- spec/integration/outputs/templates_5x_spec.rb
|
311
308
|
- spec/integration/outputs/templates_spec.rb
|
312
309
|
- spec/integration/outputs/update_spec.rb
|
313
310
|
- spec/spec_helper.rb
|