logstash-output-elasticsearch 11.22.16-java → 12.0.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 +11 -17
- data/README.md +1 -3
- data/docs/index.asciidoc +19 -106
- data/lib/logstash/outputs/elasticsearch/http_client/manticore_adapter.rb +4 -1
- data/lib/logstash/outputs/elasticsearch/http_client/pool.rb +22 -12
- data/lib/logstash/outputs/elasticsearch/http_client.rb +31 -44
- data/lib/logstash/outputs/elasticsearch/template_manager.rb +1 -16
- data/lib/logstash/outputs/elasticsearch.rb +0 -47
- data/lib/logstash/plugin_mixins/elasticsearch/api_configs.rb +12 -28
- data/lib/logstash/plugin_mixins/elasticsearch/common.rb +1 -11
- data/logstash-output-elasticsearch.gemspec +2 -2
- data/spec/es_spec_helper.rb +22 -34
- data/spec/fixtures/test_certs/GENERATED_AT +1 -1
- data/spec/fixtures/test_certs/ca.crt +27 -30
- data/spec/fixtures/test_certs/ca.der.sha256 +1 -1
- data/spec/fixtures/test_certs/renew.sh +3 -2
- data/spec/fixtures/test_certs/test.crt +28 -29
- data/spec/fixtures/test_certs/test.der.sha256 +1 -1
- data/spec/fixtures/test_certs/test.p12 +0 -0
- data/spec/integration/outputs/compressed_indexing_spec.rb +1 -3
- data/spec/integration/outputs/delete_spec.rb +4 -4
- data/spec/integration/outputs/ilm_spec.rb +12 -18
- data/spec/integration/outputs/index_spec.rb +2 -12
- data/spec/integration/outputs/index_version_spec.rb +7 -7
- data/spec/integration/outputs/metrics_spec.rb +1 -4
- data/spec/integration/outputs/painless_update_spec.rb +10 -11
- data/spec/integration/outputs/unsupported_actions_spec.rb +10 -15
- data/spec/integration/outputs/update_spec.rb +9 -11
- data/spec/spec_helper.rb +0 -8
- data/spec/support/elasticsearch/api/actions/get_alias.rb +18 -0
- data/spec/support/elasticsearch/api/actions/put_alias.rb +24 -0
- data/spec/unit/outputs/elasticsearch/http_client_spec.rb +0 -77
- data/spec/unit/outputs/elasticsearch/template_manager_spec.rb +0 -71
- data/spec/unit/outputs/elasticsearch_spec.rb +3 -86
- data/spec/unit/outputs/elasticsearch_ssl_spec.rb +22 -0
- data/spec/unit/outputs/error_whitelist_spec.rb +1 -0
- metadata +25 -19
- data/version +0 -1
|
@@ -241,6 +241,7 @@ module LogStash; module PluginMixins; module ElasticSearch
|
|
|
241
241
|
@dlq_writer.write(event, "#{detailed_message}")
|
|
242
242
|
else
|
|
243
243
|
log_level = dig_value(response, 'index', 'error', 'type') == 'invalid_index_name_exception' ? :error : :warn
|
|
244
|
+
|
|
244
245
|
@logger.public_send(log_level, message, status: status, action: action_params, response: response)
|
|
245
246
|
end
|
|
246
247
|
end
|
|
@@ -272,7 +273,6 @@ module LogStash; module PluginMixins; module ElasticSearch
|
|
|
272
273
|
end
|
|
273
274
|
|
|
274
275
|
actions_to_retry = []
|
|
275
|
-
dlq_routed_stats = {}
|
|
276
276
|
responses.each_with_index do |response,idx|
|
|
277
277
|
action_type, action_props = response.first
|
|
278
278
|
|
|
@@ -294,11 +294,6 @@ module LogStash; module PluginMixins; module ElasticSearch
|
|
|
294
294
|
elsif @dlq_codes.include?(status)
|
|
295
295
|
handle_dlq_response("Could not index event to Elasticsearch.", action, status, response)
|
|
296
296
|
@document_level_metrics.increment(:dlq_routed)
|
|
297
|
-
if dlq_routed_stats.key?(status)
|
|
298
|
-
dlq_routed_stats[status][:count] += 1
|
|
299
|
-
else
|
|
300
|
-
dlq_routed_stats[status] = { :count => 1, :sample_event => { :action => action, :response => response } }
|
|
301
|
-
end
|
|
302
297
|
next
|
|
303
298
|
else
|
|
304
299
|
# only log what the user whitelisted
|
|
@@ -308,11 +303,6 @@ module LogStash; module PluginMixins; module ElasticSearch
|
|
|
308
303
|
end
|
|
309
304
|
end
|
|
310
305
|
|
|
311
|
-
if @dlq_writer && !dlq_routed_stats.empty?
|
|
312
|
-
total = dlq_routed_stats.values.sum { |entry| entry[:count] }
|
|
313
|
-
@logger.warn("Events could not be indexed and routing to DLQ", :count => total, :dlq_routed_stats => dlq_routed_stats)
|
|
314
|
-
end
|
|
315
|
-
|
|
316
306
|
actions_to_retry
|
|
317
307
|
end
|
|
318
308
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |s|
|
|
2
2
|
s.name = 'logstash-output-elasticsearch'
|
|
3
|
-
s.version =
|
|
3
|
+
s.version = '12.0.0'
|
|
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"
|
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
|
12
12
|
s.platform = RUBY_PLATFORM
|
|
13
13
|
|
|
14
14
|
# Files
|
|
15
|
-
s.files = Dir["lib/**/*","spec/**/*","*.gemspec","*.md","CONTRIBUTORS","Gemfile","LICENSE","NOTICE.TXT", "vendor/jar-dependencies/**/*.jar", "vendor/jar-dependencies/**/*.rb", "VERSION", "
|
|
15
|
+
s.files = Dir["lib/**/*","spec/**/*","*.gemspec","*.md","CONTRIBUTORS","Gemfile","LICENSE","NOTICE.TXT", "vendor/jar-dependencies/**/*.jar", "vendor/jar-dependencies/**/*.rb", "VERSION", "docs/**/*"]
|
|
16
16
|
|
|
17
17
|
# Tests
|
|
18
18
|
s.test_files = s.files.grep(%r{^(test|spec|features)/})
|
data/spec/es_spec_helper.rb
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
require_relative './spec_helper'
|
|
2
2
|
|
|
3
3
|
require 'elasticsearch'
|
|
4
|
+
require_relative "support/elasticsearch/api/actions/delete_ilm_policy"
|
|
5
|
+
require_relative "support/elasticsearch/api/actions/get_alias"
|
|
6
|
+
require_relative "support/elasticsearch/api/actions/put_alias"
|
|
7
|
+
require_relative "support/elasticsearch/api/actions/get_ilm_policy"
|
|
8
|
+
require_relative "support/elasticsearch/api/actions/put_ilm_policy"
|
|
4
9
|
|
|
5
10
|
require 'json'
|
|
6
11
|
require 'cabin'
|
|
7
12
|
|
|
8
|
-
# remove this condition and support package once plugin starts consuming elasticsearch-ruby v8 client
|
|
9
|
-
# in elasticsearch-ruby v7, ILM APIs were in a separate xpack gem, now directly available
|
|
10
|
-
unless elastic_ruby_v8_client_available?
|
|
11
|
-
require_relative "support/elasticsearch/api/actions/delete_ilm_policy"
|
|
12
|
-
require_relative "support/elasticsearch/api/actions/get_ilm_policy"
|
|
13
|
-
require_relative "support/elasticsearch/api/actions/put_ilm_policy"
|
|
14
|
-
end
|
|
15
|
-
|
|
16
13
|
module ESHelper
|
|
17
14
|
def get_host_port
|
|
18
15
|
if ENV["INTEGRATION"] == "true"
|
|
@@ -23,12 +20,8 @@ module ESHelper
|
|
|
23
20
|
end
|
|
24
21
|
|
|
25
22
|
def get_client
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
else
|
|
29
|
-
Elasticsearch::Client.new(:hosts => [get_host_port]).tap do |client|
|
|
30
|
-
allow(client).to receive(:verify_elasticsearch).and_return(true) # bypass client side version checking
|
|
31
|
-
end
|
|
23
|
+
Elasticsearch::Client.new(:hosts => [get_host_port]).tap do |client|
|
|
24
|
+
allow(client).to receive(:verify_elasticsearch).and_return(true) # bypass client side version checking
|
|
32
25
|
end
|
|
33
26
|
end
|
|
34
27
|
|
|
@@ -135,36 +128,31 @@ module ESHelper
|
|
|
135
128
|
end
|
|
136
129
|
|
|
137
130
|
def get_policy(client, policy_name)
|
|
138
|
-
|
|
139
|
-
client.index_lifecycle_management.get_lifecycle(policy: policy_name)
|
|
140
|
-
else
|
|
141
|
-
client.get_ilm_policy(name: policy_name)
|
|
142
|
-
end
|
|
131
|
+
client.get_ilm_policy(name: policy_name)
|
|
143
132
|
end
|
|
144
133
|
|
|
145
134
|
def put_policy(client, policy_name, policy)
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
135
|
+
client.put_ilm_policy({:name => policy_name, :body=> policy})
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
def put_alias(client, the_alias, index)
|
|
139
|
+
body = {
|
|
140
|
+
"aliases" => {
|
|
141
|
+
index => {
|
|
142
|
+
"is_write_index"=> true
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
client.put_alias({name: the_alias, body: body})
|
|
151
147
|
end
|
|
152
148
|
|
|
153
149
|
def clean_ilm(client)
|
|
154
|
-
if
|
|
155
|
-
client.index_lifecycle_management.get_lifecycle.each_key { |key| client.index_lifecycle_management.delete_lifecycle(policy: key) if key =~ /logstash-policy/ }
|
|
156
|
-
else
|
|
157
|
-
client.get_ilm_policy.each_key { |key| client.delete_ilm_policy(name: key) if key =~ /logstash-policy/ }
|
|
158
|
-
end
|
|
150
|
+
client.get_ilm_policy.each_key { |key| client.delete_ilm_policy(name: key) if key =~ /logstash-policy/ }
|
|
159
151
|
end
|
|
160
152
|
|
|
161
153
|
def supports_ilm?(client)
|
|
162
154
|
begin
|
|
163
|
-
|
|
164
|
-
client.index_lifecycle_management.get_lifecycle
|
|
165
|
-
else
|
|
166
|
-
client.get_ilm_policy
|
|
167
|
-
end
|
|
155
|
+
client.get_ilm_policy
|
|
168
156
|
true
|
|
169
157
|
rescue
|
|
170
158
|
false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
2024-06-25T21:50:58+01:00
|
|
@@ -1,32 +1,29 @@
|
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
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mvOD3OIKfODlY5t+TNICg7A3eTUXeJPcdBBnuVCiQU6TCB5
|
|
28
|
+
H+69K5w54Q6a70sHZU1IWsGT8XtbUizPNQky+LAFsE/5oUnCqtypeEu4srcZK53x
|
|
32
29
|
-----END CERTIFICATE-----
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
8b23238088af65cbae6ee9c23821068d896ec1dad081e2a1035ff70866943247
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
set -e
|
|
4
4
|
cd "$(dirname "$0")"
|
|
5
5
|
|
|
6
|
-
openssl
|
|
6
|
+
openssl x509 -x509toreq -in ca.crt -signkey ca.key -out ca.csr
|
|
7
|
+
openssl x509 -req -days 365 -in ca.csr -set_serial 0x01 -signkey ca.key -out ca.crt && rm ca.csr
|
|
7
8
|
openssl x509 -in ca.crt -outform der | sha256sum | awk '{print $1}' > ca.der.sha256
|
|
8
9
|
|
|
9
10
|
openssl x509 -x509toreq -in test.crt -signkey test.key -out test.csr
|
|
@@ -12,4 +13,4 @@ openssl x509 -in test.crt -outform der | sha256sum | awk '{print $1}' > test.der
|
|
|
12
13
|
openssl pkcs12 -export -inkey test.key -in test.crt -passout "pass:1234567890" -out test.p12
|
|
13
14
|
|
|
14
15
|
# output ISO8601 timestamp to file
|
|
15
|
-
date -Iseconds > GENERATED_AT
|
|
16
|
+
date -Iseconds > GENERATED_AT
|
|
@@ -1,31 +1,30 @@
|
|
|
1
1
|
-----BEGIN CERTIFICATE-----
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|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TIFICATE-----
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
80329a197063dea8cf7905d10d221648bbdbc05b8fb1d4c2e384b831bc6590df
|
|
Binary file
|
|
@@ -36,9 +36,7 @@ end
|
|
|
36
36
|
{
|
|
37
37
|
"Content-Encoding" => "gzip",
|
|
38
38
|
"Content-Type" => "application/json",
|
|
39
|
-
'x-elastic-product-origin' => 'logstash-output-elasticsearch'
|
|
40
|
-
'X-Elastic-Event-Count' => anything,
|
|
41
|
-
'X-Elastic-Uncompressed-Request-Length' => anything,
|
|
39
|
+
'x-elastic-product-origin' => 'logstash-output-elasticsearch'
|
|
42
40
|
}
|
|
43
41
|
}
|
|
44
42
|
|
|
@@ -39,12 +39,12 @@ describe "Versioned delete", :integration => true do
|
|
|
39
39
|
it "should ignore non-monotonic external version updates" do
|
|
40
40
|
id = "ev2"
|
|
41
41
|
subject.multi_receive([LogStash::Event.new("my_id" => id, "my_action" => "index", "message" => "foo", "my_version" => 99)])
|
|
42
|
-
r = es.get(:index => 'logstash-delete', :id => id, :refresh => true)
|
|
42
|
+
r = es.get(:index => 'logstash-delete', :type => doc_type, :id => id, :refresh => true)
|
|
43
43
|
expect(r['_version']).to eq(99)
|
|
44
44
|
expect(r['_source']['message']).to eq('foo')
|
|
45
45
|
|
|
46
46
|
subject.multi_receive([LogStash::Event.new("my_id" => id, "my_action" => "delete", "message" => "foo", "my_version" => 98)])
|
|
47
|
-
r2 = es.get(:index => 'logstash-delete', :id => id, :refresh => true)
|
|
47
|
+
r2 = es.get(:index => 'logstash-delete', :type => doc_type, :id => id, :refresh => true)
|
|
48
48
|
expect(r2['_version']).to eq(99)
|
|
49
49
|
expect(r2['_source']['message']).to eq('foo')
|
|
50
50
|
end
|
|
@@ -52,12 +52,12 @@ describe "Versioned delete", :integration => true do
|
|
|
52
52
|
it "should commit monotonic external version updates" do
|
|
53
53
|
id = "ev3"
|
|
54
54
|
subject.multi_receive([LogStash::Event.new("my_id" => id, "my_action" => "index", "message" => "foo", "my_version" => 99)])
|
|
55
|
-
r = es.get(:index => 'logstash-delete', :id => id, :refresh => true)
|
|
55
|
+
r = es.get(:index => 'logstash-delete', :type => doc_type, :id => id, :refresh => true)
|
|
56
56
|
expect(r['_version']).to eq(99)
|
|
57
57
|
expect(r['_source']['message']).to eq('foo')
|
|
58
58
|
|
|
59
59
|
subject.multi_receive([LogStash::Event.new("my_id" => id, "my_action" => "delete", "message" => "foo", "my_version" => 100)])
|
|
60
|
-
expect { es.get(:index => 'logstash-delete', :id => id, :refresh => true) }.to raise_error(
|
|
60
|
+
expect { es.get(:index => 'logstash-delete', :type => doc_type, :id => id, :refresh => true) }.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
end
|
|
@@ -102,7 +102,7 @@ shared_examples_for 'an ILM disabled Logstash' do
|
|
|
102
102
|
it 'should not install the default policy' do
|
|
103
103
|
subject.register
|
|
104
104
|
sleep(1)
|
|
105
|
-
expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(
|
|
105
|
+
expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
it 'should not write the ILM settings into the template' do
|
|
@@ -282,12 +282,12 @@ describe 'Elasticsearch has index lifecycle management enabled', :integration =>
|
|
|
282
282
|
subject.register
|
|
283
283
|
sleep(1)
|
|
284
284
|
expect(@es.indices.exists_alias(name: "logstash")).to be_truthy
|
|
285
|
-
expect(@es.
|
|
285
|
+
expect(@es.get_alias(name: "logstash")).to include("logstash-000001")
|
|
286
286
|
end
|
|
287
287
|
end
|
|
288
288
|
|
|
289
289
|
it 'should install it if it is not present' do
|
|
290
|
-
expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(
|
|
290
|
+
expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
|
|
291
291
|
subject.register
|
|
292
292
|
sleep(1)
|
|
293
293
|
expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.not_to raise_error
|
|
@@ -298,7 +298,7 @@ describe 'Elasticsearch has index lifecycle management enabled', :integration =>
|
|
|
298
298
|
subject.register
|
|
299
299
|
sleep(1)
|
|
300
300
|
expect(@es.indices.exists_alias(name: "logstash")).to be_truthy
|
|
301
|
-
expect(@es.
|
|
301
|
+
expect(@es.get_alias(name: "logstash")).to include("logstash-#{todays_date}-000001")
|
|
302
302
|
end
|
|
303
303
|
|
|
304
304
|
it 'should ingest into a single index' do
|
|
@@ -340,14 +340,14 @@ describe 'Elasticsearch has index lifecycle management enabled', :integration =>
|
|
|
340
340
|
let (:policy) { small_max_doc_policy }
|
|
341
341
|
|
|
342
342
|
before do
|
|
343
|
-
expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(
|
|
343
|
+
expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
|
|
344
344
|
put_policy(@es,ilm_policy_name, policy)
|
|
345
345
|
end
|
|
346
346
|
|
|
347
347
|
it 'should not install the default policy if it is not used' do
|
|
348
348
|
subject.register
|
|
349
349
|
sleep(1)
|
|
350
|
-
expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(
|
|
350
|
+
expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
|
|
351
351
|
end
|
|
352
352
|
end
|
|
353
353
|
|
|
@@ -357,14 +357,14 @@ describe 'Elasticsearch has index lifecycle management enabled', :integration =>
|
|
|
357
357
|
let (:policy) { max_age_policy("1d") }
|
|
358
358
|
|
|
359
359
|
before do
|
|
360
|
-
expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(
|
|
360
|
+
expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
|
|
361
361
|
put_policy(@es,ilm_policy_name, policy)
|
|
362
362
|
end
|
|
363
363
|
|
|
364
364
|
it 'should not install the default policy if it is not used' do
|
|
365
365
|
subject.register
|
|
366
366
|
sleep(1)
|
|
367
|
-
expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(
|
|
367
|
+
expect{get_policy(@es, LogStash::Outputs::ElasticSearch::DEFAULT_POLICY)}.to raise_error(Elasticsearch::Transport::Transport::Errors::NotFound)
|
|
368
368
|
end
|
|
369
369
|
end
|
|
370
370
|
|
|
@@ -374,7 +374,7 @@ describe 'Elasticsearch has index lifecycle management enabled', :integration =>
|
|
|
374
374
|
subject.register
|
|
375
375
|
sleep(1)
|
|
376
376
|
expect(@es.indices.exists_alias(name: expected_index)).to be_truthy
|
|
377
|
-
expect(@es.
|
|
377
|
+
expect(@es.get_alias(name: expected_index)).to include("#{expected_index}-#{todays_date}-000001")
|
|
378
378
|
end
|
|
379
379
|
|
|
380
380
|
it 'should write the ILM settings into the template' do
|
|
@@ -443,18 +443,17 @@ describe 'Elasticsearch has index lifecycle management enabled', :integration =>
|
|
|
443
443
|
subject.register
|
|
444
444
|
sleep(1)
|
|
445
445
|
expect(@es.indices.exists_alias(name: ilm_rollover_alias)).to be_truthy
|
|
446
|
-
expect(@es.
|
|
446
|
+
expect(@es.get_alias(name: ilm_rollover_alias)).to include("#{ilm_rollover_alias}-#{todays_date}-000001")
|
|
447
447
|
end
|
|
448
448
|
|
|
449
449
|
context 'when the custom rollover alias already exists' do
|
|
450
450
|
it 'should ignore the already exists error' do
|
|
451
451
|
expect(@es.indices.exists_alias(name: ilm_rollover_alias)).to be_falsey
|
|
452
|
-
@es
|
|
453
|
-
@es.indices.put_alias(name: ilm_rollover_alias, index: "#{ilm_rollover_alias}-#{todays_date}-000001")
|
|
452
|
+
put_alias(@es, "#{ilm_rollover_alias}-#{todays_date}-000001", ilm_rollover_alias)
|
|
454
453
|
expect(@es.indices.exists_alias(name: ilm_rollover_alias)).to be_truthy
|
|
455
454
|
subject.register
|
|
456
455
|
sleep(1)
|
|
457
|
-
expect(@es.
|
|
456
|
+
expect(@es.get_alias(name: ilm_rollover_alias)).to include("#{ilm_rollover_alias}-#{todays_date}-000001")
|
|
458
457
|
end
|
|
459
458
|
|
|
460
459
|
end
|
|
@@ -533,8 +532,3 @@ describe 'Elasticsearch has index lifecycle management enabled', :integration =>
|
|
|
533
532
|
end
|
|
534
533
|
|
|
535
534
|
end
|
|
536
|
-
|
|
537
|
-
def get_expected_error_class
|
|
538
|
-
return Elastic::Transport::Transport::Errors::NotFound if elastic_ruby_v8_client_available?
|
|
539
|
-
Elasticsearch::Transport::Transport::Errors::NotFound
|
|
540
|
-
end
|
|
@@ -215,22 +215,12 @@ describe "indexing" do
|
|
|
215
215
|
|
|
216
216
|
it "sets the correct content-type header" do
|
|
217
217
|
expected_manticore_opts = {
|
|
218
|
-
:headers => {
|
|
219
|
-
"Content-Type" => "application/json",
|
|
220
|
-
'x-elastic-product-origin' => 'logstash-output-elasticsearch',
|
|
221
|
-
'X-Elastic-Event-Count' => anything,
|
|
222
|
-
'X-Elastic-Uncompressed-Request-Length' => anything
|
|
223
|
-
},
|
|
218
|
+
:headers => {"Content-Type" => "application/json", 'x-elastic-product-origin' => 'logstash-output-elasticsearch'},
|
|
224
219
|
:body => anything
|
|
225
220
|
}
|
|
226
221
|
if secure
|
|
227
222
|
expected_manticore_opts = {
|
|
228
|
-
:headers => {
|
|
229
|
-
"Content-Type" => "application/json",
|
|
230
|
-
'x-elastic-product-origin' => 'logstash-output-elasticsearch',
|
|
231
|
-
'X-Elastic-Event-Count' => anything,
|
|
232
|
-
'X-Elastic-Uncompressed-Request-Length' => anything
|
|
233
|
-
},
|
|
223
|
+
:headers => {"Content-Type" => "application/json", 'x-elastic-product-origin' => 'logstash-output-elasticsearch'},
|
|
234
224
|
:body => anything,
|
|
235
225
|
:auth => {
|
|
236
226
|
:user => user,
|
|
@@ -36,11 +36,11 @@ describe "Versioned indexing", :integration => true do
|
|
|
36
36
|
|
|
37
37
|
it "should default to ES version" do
|
|
38
38
|
subject.multi_receive([LogStash::Event.new("my_id" => "123", "message" => "foo")])
|
|
39
|
-
r = es.get(:index => 'logstash-index', :id =>
|
|
39
|
+
r = es.get(:index => 'logstash-index', :type => doc_type, :id => "123", :refresh => true)
|
|
40
40
|
expect(r["_version"]).to eq(1)
|
|
41
41
|
expect(r["_source"]["message"]).to eq('foo')
|
|
42
42
|
subject.multi_receive([LogStash::Event.new("my_id" => "123", "message" => "foobar")])
|
|
43
|
-
r2 = es.get(:index => 'logstash-index', :id =>
|
|
43
|
+
r2 = es.get(:index => 'logstash-index', :type => doc_type, :id => "123", :refresh => true)
|
|
44
44
|
expect(r2["_version"]).to eq(2)
|
|
45
45
|
expect(r2["_source"]["message"]).to eq('foobar')
|
|
46
46
|
end
|
|
@@ -63,7 +63,7 @@ describe "Versioned indexing", :integration => true do
|
|
|
63
63
|
it "should respect the external version" do
|
|
64
64
|
id = "ev1"
|
|
65
65
|
subject.multi_receive([LogStash::Event.new("my_id" => id, "my_version" => "99", "message" => "foo")])
|
|
66
|
-
r = es.get(:index => 'logstash-index', :id => id, :refresh => true)
|
|
66
|
+
r = es.get(:index => 'logstash-index', :type => doc_type, :id => id, :refresh => true)
|
|
67
67
|
expect(r["_version"]).to eq(99)
|
|
68
68
|
expect(r["_source"]["message"]).to eq('foo')
|
|
69
69
|
end
|
|
@@ -71,12 +71,12 @@ describe "Versioned indexing", :integration => true do
|
|
|
71
71
|
it "should ignore non-monotonic external version updates" do
|
|
72
72
|
id = "ev2"
|
|
73
73
|
subject.multi_receive([LogStash::Event.new("my_id" => id, "my_version" => "99", "message" => "foo")])
|
|
74
|
-
r = es.get(:index => 'logstash-index', :id => id, :refresh => true)
|
|
74
|
+
r = es.get(:index => 'logstash-index', :type => doc_type, :id => id, :refresh => true)
|
|
75
75
|
expect(r["_version"]).to eq(99)
|
|
76
76
|
expect(r["_source"]["message"]).to eq('foo')
|
|
77
77
|
|
|
78
78
|
subject.multi_receive([LogStash::Event.new("my_id" => id, "my_version" => "98", "message" => "foo")])
|
|
79
|
-
r2 = es.get(:index => 'logstash-index', :id => id, :refresh => true)
|
|
79
|
+
r2 = es.get(:index => 'logstash-index', :type => doc_type, :id => id, :refresh => true)
|
|
80
80
|
expect(r2["_version"]).to eq(99)
|
|
81
81
|
expect(r2["_source"]["message"]).to eq('foo')
|
|
82
82
|
end
|
|
@@ -84,12 +84,12 @@ describe "Versioned indexing", :integration => true do
|
|
|
84
84
|
it "should commit monotonic external version updates" do
|
|
85
85
|
id = "ev3"
|
|
86
86
|
subject.multi_receive([LogStash::Event.new("my_id" => id, "my_version" => "99", "message" => "foo")])
|
|
87
|
-
r = es.get(:index => 'logstash-index', :id => id, :refresh => true)
|
|
87
|
+
r = es.get(:index => 'logstash-index', :type => doc_type, :id => id, :refresh => true)
|
|
88
88
|
expect(r["_version"]).to eq(99)
|
|
89
89
|
expect(r["_source"]["message"]).to eq('foo')
|
|
90
90
|
|
|
91
91
|
subject.multi_receive([LogStash::Event.new("my_id" => id, "my_version" => "100", "message" => "foo")])
|
|
92
|
-
r2 = es.get(:index => 'logstash-index', :id => id, :refresh => true)
|
|
92
|
+
r2 = es.get(:index => 'logstash-index', :type => doc_type, :id => id, :refresh => true)
|
|
93
93
|
expect(r2["_version"]).to eq(100)
|
|
94
94
|
expect(r2["_source"]["message"]).to eq('foo')
|
|
95
95
|
end
|
|
@@ -5,10 +5,7 @@ describe "metrics", :integration => true do
|
|
|
5
5
|
require "logstash/outputs/elasticsearch"
|
|
6
6
|
settings = {
|
|
7
7
|
"manage_template" => false,
|
|
8
|
-
"hosts" => "#{get_host_port()}"
|
|
9
|
-
# write data to a random non templated index to ensure the bulk partially fails
|
|
10
|
-
# don't use streams like "logs-*" as those have failure stores enabled, causing the bulk to succeed instead
|
|
11
|
-
"index" => "custom_index_#{rand(10000)}"
|
|
8
|
+
"hosts" => "#{get_host_port()}"
|
|
12
9
|
}
|
|
13
10
|
plugin = LogStash::Outputs::ElasticSearch.new(settings)
|
|
14
11
|
end
|
|
@@ -22,12 +22,11 @@ describe "Update actions using painless scripts", :integration => true, :update_
|
|
|
22
22
|
# This can fail if there are no indexes, ignore failure.
|
|
23
23
|
@es.indices.delete(:index => "*") rescue nil
|
|
24
24
|
@es.index(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
})
|
|
25
|
+
:index => 'logstash-update',
|
|
26
|
+
:type => doc_type,
|
|
27
|
+
:id => "123",
|
|
28
|
+
:body => { :message => 'Test', :counter => 1 }
|
|
29
|
+
)
|
|
31
30
|
@es.indices.refresh
|
|
32
31
|
end
|
|
33
32
|
|
|
@@ -47,7 +46,7 @@ describe "Update actions using painless scripts", :integration => true, :update_
|
|
|
47
46
|
subject = get_es_output(plugin_parameters)
|
|
48
47
|
subject.register
|
|
49
48
|
subject.multi_receive([LogStash::Event.new("count" => 4 )])
|
|
50
|
-
r = @es.get(:index => 'logstash-update', :id => "123", :refresh => true)
|
|
49
|
+
r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "123", :refresh => true)
|
|
51
50
|
expect(r["_source"]["counter"]).to eq(5)
|
|
52
51
|
end
|
|
53
52
|
end
|
|
@@ -58,7 +57,7 @@ describe "Update actions using painless scripts", :integration => true, :update_
|
|
|
58
57
|
subject = get_es_output({ 'document_id' => "456", 'upsert' => '{"message": "upsert message"}' })
|
|
59
58
|
subject.register
|
|
60
59
|
subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
|
|
61
|
-
r = @es.get(:index => 'logstash-update', :id => "456", :refresh => true)
|
|
60
|
+
r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
|
|
62
61
|
expect(r["_source"]["message"]).to eq('upsert message')
|
|
63
62
|
end
|
|
64
63
|
|
|
@@ -66,7 +65,7 @@ describe "Update actions using painless scripts", :integration => true, :update_
|
|
|
66
65
|
subject = get_es_output({ 'document_id' => "456", 'doc_as_upsert' => true })
|
|
67
66
|
subject.register
|
|
68
67
|
subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
|
|
69
|
-
r = @es.get(:index => 'logstash-update', :id => "456", :refresh => true)
|
|
68
|
+
r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
|
|
70
69
|
expect(r["_source"]["message"]).to eq('sample message here')
|
|
71
70
|
end
|
|
72
71
|
|
|
@@ -83,7 +82,7 @@ describe "Update actions using painless scripts", :integration => true, :update_
|
|
|
83
82
|
subject.register
|
|
84
83
|
|
|
85
84
|
subject.multi_receive([LogStash::Event.new("message" => "sample message here")])
|
|
86
|
-
r = @es.get(:index => 'logstash-update', :id => "456", :refresh => true)
|
|
85
|
+
r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
|
|
87
86
|
expect(r["_source"]["message"]).to eq('upsert message')
|
|
88
87
|
end
|
|
89
88
|
|
|
@@ -92,7 +91,7 @@ describe "Update actions using painless scripts", :integration => true, :update_
|
|
|
92
91
|
subject.register
|
|
93
92
|
subject.multi_receive([LogStash::Event.new("counter" => 1)])
|
|
94
93
|
@es.indices.refresh
|
|
95
|
-
r = @es.get(:index => 'logstash-update', :id => "456", :refresh => true)
|
|
94
|
+
r = @es.get(:index => 'logstash-update', :type => doc_type, :id => "456", :refresh => true)
|
|
96
95
|
expect(r["_source"]["counter"]).to eq(1)
|
|
97
96
|
end
|
|
98
97
|
end
|