fluent-plugin-elasticsearch 5.3.0 → 5.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/linux.yml +1 -1
- data/.github/workflows/macos.yml +1 -1
- data/.github/workflows/windows.yml +1 -1
- data/History.md +7 -0
- data/fluent-plugin-elasticsearch.gemspec +1 -1
- data/lib/fluent/plugin/elasticsearch_compat.rb +1 -0
- data/lib/fluent/plugin/elasticsearch_index_lifecycle_management.rb +9 -9
- data/lib/fluent/plugin/out_elasticsearch.rb +23 -0
- data/lib/fluent/plugin/out_elasticsearch_data_stream.rb +4 -4
- data/test/helper.rb +0 -1
- data/test/plugin/test_elasticsearch_fallback_selector.rb +1 -1
- data/test/plugin/test_elasticsearch_index_lifecycle_management.rb +9 -13
- data/test/plugin/test_in_elasticsearch.rb +10 -10
- data/test/plugin/test_out_elasticsearch.rb +443 -345
- data/test/plugin/test_out_elasticsearch_data_stream.rb +22 -26
- data/test/plugin/test_out_elasticsearch_dynamic.rb +13 -11
- metadata +3 -3
@@ -57,6 +57,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
57
57
|
Gem::Version.create(::TRANSPORT_CLASS::VERSION) >= Gem::Version.new("7.14.0")
|
58
58
|
end
|
59
59
|
|
60
|
+
def elastic_perform_request_refactored?
|
61
|
+
Gem::Version.create(Elasticsearch::VERSION) >= Gem::Version.new("8.8.0")
|
62
|
+
end
|
63
|
+
|
60
64
|
def elastic_transport_layer?
|
61
65
|
Gem::Version.create(::TRANSPORT_CLASS::VERSION) >= Gem::Version.new("8.0.0")
|
62
66
|
end
|
@@ -84,7 +88,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
84
88
|
def stub_elastic(url="http://localhost:9200/_bulk")
|
85
89
|
stub_request(:post, url).with do |req|
|
86
90
|
@index_cmds = req.body.split("\n").map {|r| JSON.parse(r) }
|
87
|
-
end
|
91
|
+
end.to_return({:status => 200, :body => "", :headers => { 'Content-Type' => 'json', 'x-elastic-product' => 'Elasticsearch' } })
|
88
92
|
end
|
89
93
|
|
90
94
|
def stub_elastic_all_requests(url="http://localhost:9200/_bulk")
|
@@ -92,7 +96,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
92
96
|
stub_request(:post, url).with do |req|
|
93
97
|
@index_cmds = req.body.split("\n").map {|r| JSON.parse(r) }
|
94
98
|
@index_cmds_all_requests << @index_cmds
|
95
|
-
end
|
99
|
+
end.to_return({:status => 200, :body => "", :headers => { 'Content-Type' => 'json', 'x-elastic-product' => 'Elasticsearch' } })
|
96
100
|
end
|
97
101
|
|
98
102
|
def stub_elastic_unavailable(url="http://localhost:9200/_bulk")
|
@@ -112,7 +116,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
112
116
|
stub_request(:post, url).with do |req|
|
113
117
|
index_cmds = req.body.split("\n").map {|r| JSON.parse(r) }
|
114
118
|
@index_command_counts[url] += index_cmds.size
|
115
|
-
end
|
119
|
+
end.to_return({:status => 200, :body => "{}", :headers => { 'Content-Type' => 'json', 'x-elastic-product' => 'Elasticsearch' } })
|
116
120
|
end
|
117
121
|
|
118
122
|
def make_response_body(req, error_el = nil, error_status = nil, error = nil)
|
@@ -179,7 +183,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
179
183
|
"reason" => "Invalid format: \"...\""
|
180
184
|
}
|
181
185
|
}
|
182
|
-
stub_request(:post, url).to_return(lambda { |req| { :status => 200, :body => make_response_body(req, 1, 400, error), :headers => { 'Content-Type' => 'json' } } })
|
186
|
+
stub_request(:post, url).to_return(lambda { |req| { :status => 200, :body => make_response_body(req, 1, 400, error), :headers => { 'Content-Type' => 'json', 'x-elastic-product' => 'Elasticsearch' } } })
|
183
187
|
end
|
184
188
|
|
185
189
|
def stub_elastic_bulk_error(url="http://localhost:9200/_bulk")
|
@@ -187,7 +191,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
187
191
|
"type" => "some-unrecognized-error",
|
188
192
|
"reason" => "some message printed here ...",
|
189
193
|
}
|
190
|
-
stub_request(:post, url).to_return(lambda { |req| { :status => 200, :body => make_response_body(req, 1, 500, error), :headers => { 'Content-Type' => 'json' } } })
|
194
|
+
stub_request(:post, url).to_return(lambda { |req| { :status => 200, :body => make_response_body(req, 1, 500, error), :headers => { 'Content-Type' => 'json', 'x-elastic-product' => 'Elasticsearch' } } })
|
191
195
|
end
|
192
196
|
|
193
197
|
def stub_elastic_bulk_rejected(url="http://localhost:9200/_bulk")
|
@@ -196,7 +200,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
196
200
|
"type" => "es_rejected_execution_exception",
|
197
201
|
"reason" => "rejected execution of org.elasticsearch.transport.TransportService$4@1a34d37a on EsThreadPoolExecutor[bulk, queue capacity = 50, org.elasticsearch.common.util.concurrent.EsThreadPoolExecutor@312a2162[Running, pool size = 32, active threads = 32, queued tasks = 50, completed tasks = 327053]]"
|
198
202
|
}
|
199
|
-
stub_request(:post, url).to_return(lambda { |req| { :status => 200, :body => make_response_body(req, 1, 429, error), :headers => { 'Content-Type' => 'json' } } })
|
203
|
+
stub_request(:post, url).to_return(lambda { |req| { :status => 200, :body => make_response_body(req, 1, 429, error), :headers => { 'Content-Type' => 'json', 'x-elastic-product' => 'Elasticsearch' } } })
|
200
204
|
end
|
201
205
|
|
202
206
|
def stub_elastic_out_of_memory(url="http://localhost:9200/_bulk")
|
@@ -205,7 +209,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
205
209
|
"type" => "out_of_memory_error",
|
206
210
|
"reason" => "Java heap space"
|
207
211
|
}
|
208
|
-
stub_request(:post, url).to_return(lambda { |req| { :status => 200, :body => make_response_body(req, 1, 500, error), :headers => { 'Content-Type' => 'json' } } })
|
212
|
+
stub_request(:post, url).to_return(lambda { |req| { :status => 200, :body => make_response_body(req, 1, 500, error), :headers => { 'Content-Type' => 'json', 'x-elastic-product' => 'Elasticsearch' } } })
|
209
213
|
end
|
210
214
|
|
211
215
|
def stub_elastic_unexpected_response_op(url="http://localhost:9200/_bulk")
|
@@ -213,7 +217,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
213
217
|
"category" => "some-other-type",
|
214
218
|
"reason" => "some-other-reason"
|
215
219
|
}
|
216
|
-
stub_request(:post, url).to_return(lambda { |req| bodystr = make_response_body(req, 0, 500, error); body = JSON.parse(bodystr); body['items'][0]['unknown'] = body['items'][0].delete('create'); { :status => 200, :body => body.to_json, :headers => { 'Content-Type' => 'json' } } })
|
220
|
+
stub_request(:post, url).to_return(lambda { |req| bodystr = make_response_body(req, 0, 500, error); body = JSON.parse(bodystr); body['items'][0]['unknown'] = body['items'][0].delete('create'); { :status => 200, :body => body.to_json, :headers => { 'Content-Type' => 'json', 'x-elastic-product' => 'Elasticsearch' } } })
|
217
221
|
end
|
218
222
|
|
219
223
|
def assert_logs_include(logs, msg, exp_matches=1)
|
@@ -324,7 +328,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
324
328
|
end
|
325
329
|
|
326
330
|
stub_request(:post, "http://localhost:9200/_bulk").
|
327
|
-
to_return(status: 200, body: "", headers: {})
|
331
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
328
332
|
stub_elastic_info
|
329
333
|
driver.run(default_tag: 'test') do
|
330
334
|
driver.feed(sample_record)
|
@@ -357,7 +361,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
357
361
|
end
|
358
362
|
|
359
363
|
stub_request(:post, "http://localhost:9200/_bulk").
|
360
|
-
to_return(status: 200, body: "", headers: {})
|
364
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch' })
|
361
365
|
stub_elastic_info
|
362
366
|
driver.run(default_tag: 'test') do
|
363
367
|
driver.feed(sample_record)
|
@@ -458,7 +462,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
458
462
|
|
459
463
|
def stub_elastic_info_bad(url="http://localhost:9200/", version="6.4.2")
|
460
464
|
body ="{\"version\":{\"number\":\"#{version}\",\"build_flavor\":\"default\"},\"tagline\":\"You Know, for Search\"}"
|
461
|
-
stub_request(:get, url).to_return({:status => 200, :body => body, :headers => { 'Content-Type' => 'text/plain' } })
|
465
|
+
stub_request(:get, url).to_return({:status => 200, :body => body, :headers => { 'Content-Type' => 'text/plain', 'x-elastic-product' => 'Elasticsearch'} })
|
462
466
|
end
|
463
467
|
|
464
468
|
test 'handle invalid client.info' do
|
@@ -474,7 +478,11 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
474
478
|
scheme https
|
475
479
|
@log_level info
|
476
480
|
}
|
477
|
-
if
|
481
|
+
if elastic_perform_request_refactored?
|
482
|
+
d = create_driver(config, 8, "\"8.8.0\"")
|
483
|
+
logs = d.logs
|
484
|
+
assert_logs_include(logs, /Detected ES 7.x: `_doc` will be used as the document `_type`./)
|
485
|
+
elsif elastic_transport_layer?
|
478
486
|
assert_raise(NoMethodError) do
|
479
487
|
d = create_driver(config, 8, "\"8.0.0\"")
|
480
488
|
end
|
@@ -516,11 +524,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
516
524
|
end
|
517
525
|
|
518
526
|
def ilm_endpoint
|
519
|
-
|
520
|
-
'_enrich'.freeze
|
521
|
-
else
|
522
|
-
'_ilm'.freeze
|
523
|
-
end
|
527
|
+
'_ilm'.freeze
|
524
528
|
end
|
525
529
|
|
526
530
|
data("legacy_template" => [true, "_template"],
|
@@ -543,22 +547,22 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
543
547
|
use_legacy_template #{use_legacy_template_flag}
|
544
548
|
}
|
545
549
|
stub_request(:get, "http://localhost:9200/#{endpoint}/fluentd").
|
546
|
-
to_return(status: 200, body: "", headers: {})
|
550
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
547
551
|
stub_request(:head, "http://localhost:9200/_alias/fluentd").
|
548
|
-
to_return(status: 404, body: "", headers: {})
|
552
|
+
to_return(status: 404, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
549
553
|
stub_request(:put, "http://localhost:9200/%3Cfluentd-default-%7Bnow%2Fd%7D-000001%3E/#{alias_endpoint}/fluentd").
|
550
554
|
with(body: "{\"aliases\":{\"fluentd\":{\"is_write_index\":true}}}").
|
551
|
-
to_return(status: 200, body: "", headers: {})
|
555
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
552
556
|
stub_request(:put, "http://localhost:9200/%3Cfluentd-default-%7Bnow%2Fd%7D-000001%3E").
|
553
|
-
to_return(status: 200, body: "", headers: {})
|
557
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
554
558
|
stub_request(:get, "http://localhost:9200/_xpack").
|
555
559
|
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}',
|
556
|
-
:headers => {"Content-Type"=> "application/json"})
|
560
|
+
:headers => {"Content-Type"=> "application/json", 'x-elastic-product' => 'Elasticsearch'})
|
557
561
|
stub_request(:get, "http://localhost:9200/#{ilm_endpoint}/policy/logstash-policy").
|
558
|
-
to_return(status: 404, body: "", headers: {})
|
562
|
+
to_return(status: 404, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
559
563
|
stub_request(:put, "http://localhost:9200/#{ilm_endpoint}/policy/logstash-policy").
|
560
564
|
with(body: "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
561
|
-
to_return(status: 200, body: "", headers: {})
|
565
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
562
566
|
stub_elastic_info
|
563
567
|
|
564
568
|
assert_nothing_raised {
|
@@ -588,22 +592,22 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
588
592
|
use_legacy_template #{use_legacy_template_flag}
|
589
593
|
}
|
590
594
|
stub_request(:get, "http://localhost:9200/#{endpoint}/fluentd").
|
591
|
-
to_return(status: 200, body: "", headers: {})
|
595
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
592
596
|
stub_request(:head, "http://localhost:9200/_alias/fluentd").
|
593
|
-
to_return(status: 404, body: "", headers: {})
|
597
|
+
to_return(status: 404, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
594
598
|
stub_request(:put, "http://localhost:9200/%3Cfluentd-default-%7Bnow%2Fd%7D-000001%3E/#{alias_endpoint}/fluentd").
|
595
599
|
with(body: "{\"aliases\":{\"fluentd\":{\"is_write_index\":true}}}").
|
596
|
-
to_return(status: 200, body: "", headers: {})
|
600
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
597
601
|
stub_request(:put, "http://localhost:9200/%3Cfluentd-default-%7Bnow%2Fd%7D-000001%3E").
|
598
|
-
to_return(status: 200, body: "", headers: {})
|
602
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
599
603
|
stub_request(:get, "http://localhost:9200/_xpack").
|
600
604
|
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}',
|
601
|
-
:headers => {"Content-Type"=> "application/json"})
|
605
|
+
:headers => {"Content-Type"=> "application/json", 'x-elastic-product' => 'Elasticsearch'})
|
602
606
|
stub_request(:get, "http://localhost:9200/#{ilm_endpoint}/policy/logstash-policy").
|
603
|
-
to_return(status: 200, body: "", headers: {})
|
607
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
604
608
|
stub_request(:put, "http://localhost:9200/#{ilm_endpoint}/policy/logstash-policy").
|
605
609
|
with(body: "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"75gb\",\"max_age\":\"50d\"}}}}}}").
|
606
|
-
to_return(status: 200, body: "", headers: {})
|
610
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
607
611
|
stub_elastic_info
|
608
612
|
|
609
613
|
assert_nothing_raised {
|
@@ -954,11 +958,11 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
954
958
|
# connection start
|
955
959
|
stub_request(:head, "https://logs.google.com:777/es//").
|
956
960
|
with(basic_auth: ['john', 'doe']).
|
957
|
-
to_return(:status => 200, :body => "", :headers => {})
|
961
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
958
962
|
# check if template exists
|
959
963
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
960
964
|
with(basic_auth: ['john', 'doe']).
|
961
|
-
to_return(:status => 200, :body => "", :headers => {})
|
965
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
962
966
|
stub_elastic_info("https://logs.google.com:777/es//")
|
963
967
|
|
964
968
|
driver(config)
|
@@ -995,15 +999,15 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
995
999
|
# connection start
|
996
1000
|
stub_request(:head, "https://logs.google.com:777/es//").
|
997
1001
|
with(basic_auth: ['john', 'doe']).
|
998
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1002
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
999
1003
|
# check if template exists
|
1000
1004
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1001
1005
|
with(basic_auth: ['john', 'doe']).
|
1002
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1006
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1003
1007
|
# creation
|
1004
1008
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1005
1009
|
with(basic_auth: ['john', 'doe']).
|
1006
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1010
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1007
1011
|
stub_elastic_info("https://logs.google.com:777/es//")
|
1008
1012
|
|
1009
1013
|
driver(config)
|
@@ -1043,27 +1047,27 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1043
1047
|
# connection start
|
1044
1048
|
stub_request(:head, "https://logs.google.com:777/es//").
|
1045
1049
|
with(basic_auth: ['john', 'doe']).
|
1046
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1050
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1047
1051
|
# check if template exists
|
1048
1052
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash-test.template").
|
1049
1053
|
with(basic_auth: ['john', 'doe']).
|
1050
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1054
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1051
1055
|
# create template
|
1052
1056
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash-test.template").
|
1053
1057
|
with(basic_auth: ['john', 'doe']).
|
1054
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1058
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1055
1059
|
# check if alias exists
|
1056
1060
|
stub_request(:head, "https://logs.google.com:777/es//_alias/myapp_deflector-test.template").
|
1057
1061
|
with(basic_auth: ['john', 'doe']).
|
1058
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1062
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1059
1063
|
# put the alias for the index
|
1060
1064
|
stub_request(:put, "https://logs.google.com:777/es//%3Cfluentd-test.template-default-000001%3E").
|
1061
1065
|
with(basic_auth: ['john', 'doe']).
|
1062
|
-
to_return(status: 200, body: "", headers: {})
|
1066
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1063
1067
|
stub_request(:put, "https://logs.google.com:777/es//%3Cfluentd-test.template-default-000001%3E/#{alias_endpoint}/myapp_deflector-test.template").
|
1064
1068
|
with(basic_auth: ['john', 'doe'],
|
1065
1069
|
body: "{\"aliases\":{\"myapp_deflector-test.template\":{\"is_write_index\":true}}}").
|
1066
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1070
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1067
1071
|
|
1068
1072
|
driver(config)
|
1069
1073
|
|
@@ -1113,27 +1117,27 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1113
1117
|
# connection start
|
1114
1118
|
stub_request(:head, "https://logs.google.com:777/es//").
|
1115
1119
|
with(basic_auth: ['john', 'doe']).
|
1116
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1120
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1117
1121
|
# check if template exists
|
1118
1122
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash-test.template").
|
1119
1123
|
with(basic_auth: ['john', 'doe']).
|
1120
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1124
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1121
1125
|
# create template
|
1122
1126
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash-test.template").
|
1123
1127
|
with(basic_auth: ['john', 'doe']).
|
1124
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1128
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1125
1129
|
# check if alias exists
|
1126
1130
|
stub_request(:head, "https://logs.google.com:777/es//_alias/myapp_deflector-test.template").
|
1127
1131
|
with(basic_auth: ['john', 'doe']).
|
1128
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1132
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1129
1133
|
# put the alias for the index
|
1130
1134
|
stub_request(:put, "https://logs.google.com:777/es//%3Cfluentd-test.template-default-000001%3E").
|
1131
1135
|
with(basic_auth: ['john', 'doe']).
|
1132
|
-
to_return(status: 200, body: "", headers: {})
|
1136
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1133
1137
|
stub_request(:put, "https://logs.google.com:777/es//%3Cfluentd-test.template-default-000001%3E/#{alias_endpoint}/myapp_deflector-test.template").
|
1134
1138
|
with(basic_auth: ['john', 'doe'],
|
1135
1139
|
body: "{\"aliases\":{\"myapp_deflector-test.template\":{\"is_write_index\":true}}}").
|
1136
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1140
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1137
1141
|
stub_elastic_info("https://logs.google.com:777/es//")
|
1138
1142
|
|
1139
1143
|
driver(config)
|
@@ -1171,11 +1175,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1171
1175
|
end
|
1172
1176
|
|
1173
1177
|
def ilm_endpoint
|
1174
|
-
|
1175
|
-
'_enrich'.freeze
|
1176
|
-
else
|
1177
|
-
'_ilm'.freeze
|
1178
|
-
end
|
1178
|
+
'_ilm'.freeze
|
1179
1179
|
end
|
1180
1180
|
|
1181
1181
|
data("legacy_template" => [true, "_template"],
|
@@ -1210,51 +1210,51 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1210
1210
|
# connection start
|
1211
1211
|
stub_request(:head, "https://logs.google.com:777/es//").
|
1212
1212
|
with(basic_auth: ['john', 'doe']).
|
1213
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1213
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1214
1214
|
# check if template exists
|
1215
1215
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1216
1216
|
with(basic_auth: ['john', 'doe']).
|
1217
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1217
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1218
1218
|
# creation
|
1219
1219
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1220
1220
|
with(basic_auth: ['john', 'doe']).
|
1221
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1221
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1222
1222
|
# check if alias exists
|
1223
1223
|
stub_request(:head, "https://logs.google.com:777/es//_alias/logstash").
|
1224
1224
|
with(basic_auth: ['john', 'doe']).
|
1225
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1225
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1226
1226
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1227
1227
|
with(basic_auth: ['john', 'doe']).
|
1228
|
-
to_return(status: 404, body: "", headers: {})
|
1228
|
+
to_return(status: 404, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1229
1229
|
if use_legacy_template_flag
|
1230
1230
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1231
1231
|
with(basic_auth: ['john', 'doe'],
|
1232
1232
|
body: "{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"logstash-policy\",\"index.lifecycle.rollover_alias\":\"logstash\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}},\"index_patterns\":\"logstash-*\",\"order\":51}").
|
1233
|
-
to_return(status: 200, body: "", headers: {})
|
1233
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1234
1234
|
else
|
1235
1235
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1236
1236
|
with(basic_auth: ['john', 'doe'],
|
1237
1237
|
body: "{\"index_patterns\":\"logstash-*\",\"template\":{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"logstash-policy\",\"index.lifecycle.rollover_alias\":\"logstash\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}}},\"priority\":101}").
|
1238
|
-
to_return(status: 200, body: "", headers: {})
|
1238
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1239
1239
|
end
|
1240
1240
|
# put the alias for the index
|
1241
1241
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash-default-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E").
|
1242
1242
|
with(basic_auth: ['john', 'doe']).
|
1243
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1243
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1244
1244
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash-default-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E/#{alias_endpoint}/logstash").
|
1245
1245
|
with(basic_auth: ['john', 'doe'],
|
1246
1246
|
:body => "{\"aliases\":{\"logstash\":{\"is_write_index\":true}}}").
|
1247
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1247
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1248
1248
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
1249
1249
|
with(basic_auth: ['john', 'doe']).
|
1250
|
-
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
1250
|
+
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json", 'x-elastic-product' => 'Elasticsearch'})
|
1251
1251
|
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
1252
1252
|
with(basic_auth: ['john', 'doe']).
|
1253
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1253
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1254
1254
|
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
1255
1255
|
with(basic_auth: ['john', 'doe'],
|
1256
1256
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
1257
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1257
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1258
1258
|
stub_elastic_info("https://logs.google.com:777/es//")
|
1259
1259
|
|
1260
1260
|
driver(config)
|
@@ -1296,52 +1296,52 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1296
1296
|
# connection start
|
1297
1297
|
stub_request(:head, "https://logs.google.com:777/es//").
|
1298
1298
|
with(basic_auth: ['john', 'doe']).
|
1299
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1299
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1300
1300
|
# check if template exists
|
1301
1301
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash-#{date_str}").
|
1302
1302
|
with(basic_auth: ['john', 'doe']).
|
1303
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1303
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1304
1304
|
# creation
|
1305
1305
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash-#{date_str}").
|
1306
1306
|
with(basic_auth: ['john', 'doe']).
|
1307
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1307
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1308
1308
|
# check if alias exists
|
1309
1309
|
stub_request(:head, "https://logs.google.com:777/es//_alias/logstash-#{date_str}").
|
1310
1310
|
with(basic_auth: ['john', 'doe']).
|
1311
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1311
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1312
1312
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash-#{date_str}").
|
1313
1313
|
with(basic_auth: ['john', 'doe']).
|
1314
|
-
to_return(status: 404, body: "", headers: {})
|
1314
|
+
to_return(status: 404, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1315
1315
|
if use_legacy_template_flag
|
1316
1316
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash-#{date_str}").
|
1317
1317
|
with(basic_auth: ['john', 'doe'],
|
1318
1318
|
body: "{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"logstash-policy\",\"index.lifecycle.rollover_alias\":\"logstash-log-#{date_str}\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}},\"index_patterns\":\"logstash-log-#{date_str}-*\",\"order\":53}").
|
1319
|
-
to_return(status: 200, body: "", headers: {})
|
1319
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1320
1320
|
else
|
1321
1321
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash-#{date_str}").
|
1322
1322
|
with(basic_auth: ['john', 'doe'],
|
1323
1323
|
body: "{\"index_patterns\":\"logstash-log-2020.09.21-*\",\"template\":{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"logstash-policy\",\"index.lifecycle.rollover_alias\":\"logstash-2020.09.21\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}}},\"priority\":103}").
|
1324
|
-
to_return(status: 200, body: "", headers: {})
|
1324
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1325
1325
|
end
|
1326
1326
|
# put the alias for the index
|
1327
1327
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash-log-#{date_str}-000001%3E").
|
1328
1328
|
with(basic_auth: ['john', 'doe']).
|
1329
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1329
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1330
1330
|
|
1331
1331
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash-log-#{date_str}-000001%3E/#{alias_endpoint}/logstash-#{date_str}").
|
1332
1332
|
with(basic_auth: ['john', 'doe'],
|
1333
1333
|
body: "{\"aliases\":{\"logstash-#{date_str}\":{\"is_write_index\":true}}}").
|
1334
|
-
to_return(status: 200, body: "", headers: {})
|
1334
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1335
1335
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
1336
1336
|
with(basic_auth: ['john', 'doe']).
|
1337
|
-
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
1337
|
+
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json", 'x-elastic-product' => 'Elasticsearch'})
|
1338
1338
|
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
1339
1339
|
with(basic_auth: ['john', 'doe']).
|
1340
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1340
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1341
1341
|
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
1342
1342
|
with(basic_auth: ['john', 'doe'],
|
1343
1343
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
1344
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1344
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1345
1345
|
stub_elastic_info("https://logs.google.com:777/es//")
|
1346
1346
|
|
1347
1347
|
driver(config)
|
@@ -1389,51 +1389,51 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1389
1389
|
# connection start
|
1390
1390
|
stub_request(:head, "https://logs.google.com:777/es//").
|
1391
1391
|
with(basic_auth: ['john', 'doe']).
|
1392
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1392
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1393
1393
|
# check if template exists
|
1394
1394
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1395
1395
|
with(basic_auth: ['john', 'doe']).
|
1396
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1396
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1397
1397
|
# creation
|
1398
1398
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1399
1399
|
with(basic_auth: ['john', 'doe']).
|
1400
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1400
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1401
1401
|
# check if alias exists
|
1402
1402
|
stub_request(:head, "https://logs.google.com:777/es//_alias/logstash").
|
1403
1403
|
with(basic_auth: ['john', 'doe']).
|
1404
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1404
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1405
1405
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1406
1406
|
with(basic_auth: ['john', 'doe']).
|
1407
|
-
to_return(status: 404, body: "", headers: {})
|
1407
|
+
to_return(status: 404, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1408
1408
|
if use_legacy_template_flag
|
1409
1409
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1410
1410
|
with(basic_auth: ['john', 'doe'],
|
1411
1411
|
body: "{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"logstash-policy\",\"index.lifecycle.rollover_alias\":\"logstash\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}},\"index_patterns\":\"logstash-*\",\"order\":51}").
|
1412
|
-
to_return(status: 200, body: "", headers: {})
|
1412
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1413
1413
|
else
|
1414
1414
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1415
1415
|
with(basic_auth: ['john', 'doe'],
|
1416
1416
|
body: "{\"index_patterns\":\"logstash-*\",\"template\":{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"logstash-policy\",\"index.lifecycle.rollover_alias\":\"logstash\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}}},\"priority\":101}").
|
1417
|
-
to_return(status: 200, body: "", headers: {})
|
1417
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1418
1418
|
end
|
1419
1419
|
# put the alias for the index
|
1420
1420
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash-default-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E").
|
1421
1421
|
with(basic_auth: ['john', 'doe']).
|
1422
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1422
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1423
1423
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash-default-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E/#{alias_endpoint}/logstash").
|
1424
1424
|
with(basic_auth: ['john', 'doe'],
|
1425
1425
|
:body => "{\"aliases\":{\"logstash\":{\"is_write_index\":true}}}").
|
1426
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1426
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1427
1427
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
1428
1428
|
with(basic_auth: ['john', 'doe']).
|
1429
|
-
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
1429
|
+
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json", 'x-elastic-product' => 'Elasticsearch'})
|
1430
1430
|
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
1431
1431
|
with(basic_auth: ['john', 'doe']).
|
1432
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1432
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1433
1433
|
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
1434
1434
|
with(basic_auth: ['john', 'doe'],
|
1435
1435
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"60gb\",\"max_age\":\"45d\"}}}}}}").
|
1436
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1436
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1437
1437
|
stub_elastic_info("https://logs.google.com:777/es//")
|
1438
1438
|
|
1439
1439
|
driver(config)
|
@@ -1498,51 +1498,51 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1498
1498
|
# connection start
|
1499
1499
|
stub_request(:head, "https://logs.google.com:777/es//").
|
1500
1500
|
with(basic_auth: ['john', 'doe']).
|
1501
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1501
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1502
1502
|
# check if template exists
|
1503
1503
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1504
1504
|
with(basic_auth: ['john', 'doe']).
|
1505
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1505
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1506
1506
|
# creation
|
1507
1507
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1508
1508
|
with(basic_auth: ['john', 'doe']).
|
1509
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1509
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1510
1510
|
# check if alias exists
|
1511
1511
|
stub_request(:head, "https://logs.google.com:777/es//_alias/logstash").
|
1512
1512
|
with(basic_auth: ['john', 'doe']).
|
1513
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1513
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1514
1514
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1515
1515
|
with(basic_auth: ['john', 'doe']).
|
1516
|
-
to_return(status: 404, body: "", headers: {})
|
1516
|
+
to_return(status: 404, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1517
1517
|
if use_legacy_template_flag
|
1518
1518
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/myapp_deflector").
|
1519
1519
|
with(basic_auth: ['john', 'doe'],
|
1520
1520
|
body: "{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"logstash-policy\",\"index.lifecycle.rollover_alias\":\"logstash\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}},\"index_patterns\":\"logstash-*\",\"order\":51}").
|
1521
|
-
to_return(status: 200, body: "", headers: {})
|
1521
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1522
1522
|
else
|
1523
1523
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/myapp_deflector").
|
1524
1524
|
with(basic_auth: ['john', 'doe'],
|
1525
1525
|
body: "{\"index_patterns\":\"logstash-*\",\"template\":{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"logstash-policy\",\"index.lifecycle.rollover_alias\":\"logstash\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}}},\"priority\":101}").
|
1526
|
-
to_return(status: 200, body: "", headers: {})
|
1526
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1527
1527
|
end
|
1528
1528
|
# put the alias for the index
|
1529
1529
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash-default-000001%3E").
|
1530
1530
|
with(basic_auth: ['john', 'doe']).
|
1531
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1531
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1532
1532
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash-default-000001%3E/#{alias_endpoint}/logstash").
|
1533
1533
|
with(basic_auth: ['john', 'doe'],
|
1534
1534
|
:body => "{\"aliases\":{\"logstash\":{\"is_write_index\":true}}}").
|
1535
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1535
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1536
1536
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
1537
1537
|
with(basic_auth: ['john', 'doe']).
|
1538
|
-
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
1538
|
+
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json", 'x-elastic-product' => 'Elasticsearch'})
|
1539
1539
|
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
1540
1540
|
with(basic_auth: ['john', 'doe']).
|
1541
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1541
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1542
1542
|
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
1543
1543
|
with(basic_auth: ['john', 'doe'],
|
1544
1544
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
1545
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1545
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1546
1546
|
stub_elastic_info("https://logs.google.com:777/es//")
|
1547
1547
|
|
1548
1548
|
driver(config)
|
@@ -1584,50 +1584,50 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1584
1584
|
# connection start
|
1585
1585
|
stub_request(:head, "https://logs.google.com:777/es//").
|
1586
1586
|
with(basic_auth: ['john', 'doe']).
|
1587
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1587
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1588
1588
|
# check if template exists
|
1589
1589
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1590
1590
|
with(basic_auth: ['john', 'doe']).
|
1591
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1591
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1592
1592
|
# creation
|
1593
1593
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1594
1594
|
with(basic_auth: ['john', 'doe']).
|
1595
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1595
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1596
1596
|
# check if alias exists
|
1597
1597
|
stub_request(:head, "https://logs.google.com:777/es//_alias/logstash").
|
1598
1598
|
with(basic_auth: ['john', 'doe']).
|
1599
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1599
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1600
1600
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1601
1601
|
with(basic_auth: ['john', 'doe']).
|
1602
|
-
to_return(status: 404, body: "", headers: {})
|
1602
|
+
to_return(status: 404, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1603
1603
|
if use_legacy_template_flag
|
1604
1604
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1605
1605
|
with(basic_auth: ['john', 'doe'],
|
1606
1606
|
body: "{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"fluentd-policy\",\"index.lifecycle.rollover_alias\":\"myalogs\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}},\"index_patterns\":\"mylogs-*\",\"order\":51}").
|
1607
|
-
to_return(status: 200, body: "", headers: {})
|
1607
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1608
1608
|
else
|
1609
1609
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1610
1610
|
with(basic_auth: ['john', 'doe'],
|
1611
1611
|
body: "{\"index_patterns\":\"logstash-*\",\"template\":{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"fluentd-policy\",\"index.lifecycle.rollover_alias\":\"logstash\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}}},\"priority\":101}").
|
1612
|
-
to_return(status: 200, body: "", headers: {})
|
1612
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1613
1613
|
end
|
1614
1614
|
# put the alias for the index
|
1615
1615
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash-default-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E").
|
1616
1616
|
with(basic_auth: ['john', 'doe']).
|
1617
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1617
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1618
1618
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash-default-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E/#{alias_endpoint}/logstash").
|
1619
1619
|
with(body: "{\"aliases\":{\"logstash\":{\"is_write_index\":true}}}").
|
1620
|
-
to_return(status: 200, body: "", headers: {})
|
1620
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1621
1621
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
1622
1622
|
with(basic_auth: ['john', 'doe']).
|
1623
|
-
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
1623
|
+
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json", 'x-elastic-product' => 'Elasticsearch'})
|
1624
1624
|
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
1625
1625
|
with(basic_auth: ['john', 'doe']).
|
1626
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1626
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1627
1627
|
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
1628
1628
|
with(basic_auth: ['john', 'doe'],
|
1629
1629
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"70gb\",\"max_age\":\"30d\"}}}}}}").
|
1630
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1630
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1631
1631
|
stub_elastic_info("https://logs.google.com:777/es//")
|
1632
1632
|
|
1633
1633
|
driver(config)
|
@@ -1669,50 +1669,50 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1669
1669
|
# connection start
|
1670
1670
|
stub_request(:head, "https://logs.google.com:777/es//").
|
1671
1671
|
with(basic_auth: ['john', 'doe']).
|
1672
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1672
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1673
1673
|
# check if template exists
|
1674
1674
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1675
1675
|
with(basic_auth: ['john', 'doe']).
|
1676
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1676
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1677
1677
|
# creation
|
1678
1678
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1679
1679
|
with(basic_auth: ['john', 'doe']).
|
1680
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1680
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1681
1681
|
# check if alias exists
|
1682
1682
|
stub_request(:head, "https://logs.google.com:777/es//_alias/logstash").
|
1683
1683
|
with(basic_auth: ['john', 'doe']).
|
1684
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1684
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1685
1685
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1686
1686
|
with(basic_auth: ['john', 'doe']).
|
1687
|
-
to_return(status: 404, body: "", headers: {})
|
1687
|
+
to_return(status: 404, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1688
1688
|
if use_legacy_template_flag
|
1689
1689
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1690
1690
|
with(basic_auth: ['john', 'doe'],
|
1691
1691
|
body: "{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"fluentd-policy\",\"index.lifecycle.rollover_alias\":\"myalogs\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}},\"index_patterns\":\"mylogs-*\",\"order\":51}").
|
1692
|
-
to_return(status: 200, body: "", headers: {})
|
1692
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1693
1693
|
else
|
1694
1694
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1695
1695
|
with(basic_auth: ['john', 'doe'],
|
1696
1696
|
body: "{\"index_patterns\":\"logstash-*\",\"template\":{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"fluentd-policy\",\"index.lifecycle.rollover_alias\":\"logstash\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}}},\"priority\":101}").
|
1697
|
-
to_return(status: 200, body: "", headers: {})
|
1697
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1698
1698
|
end
|
1699
1699
|
# put the alias for the index
|
1700
1700
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash-default-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E").
|
1701
1701
|
with(basic_auth: ['john', 'doe']).
|
1702
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1702
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1703
1703
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash-default-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E/#{alias_endpoint}/logstash").
|
1704
1704
|
with(body: "{\"aliases\":{\"logstash\":{\"is_write_index\":true}}}").
|
1705
|
-
to_return(status: 200, body: "", headers: {})
|
1705
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1706
1706
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
1707
1707
|
with(basic_auth: ['john', 'doe']).
|
1708
|
-
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
1708
|
+
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json", 'x-elastic-product' => 'Elasticsearch'})
|
1709
1709
|
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
1710
1710
|
with(basic_auth: ['john', 'doe']).
|
1711
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1711
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1712
1712
|
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
1713
1713
|
with(basic_auth: ['john', 'doe'],
|
1714
1714
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"70gb\",\"max_age\":\"30d\"}}}}}}").
|
1715
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1715
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1716
1716
|
stub_elastic_info("https://logs.google.com:777/es//")
|
1717
1717
|
|
1718
1718
|
driver(config)
|
@@ -1761,50 +1761,50 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1761
1761
|
# connection start
|
1762
1762
|
stub_request(:head, "https://logs.google.com:777/es//").
|
1763
1763
|
with(basic_auth: ['john', 'doe']).
|
1764
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1764
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1765
1765
|
# check if template exists
|
1766
1766
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1767
1767
|
with(basic_auth: ['john', 'doe']).
|
1768
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1768
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1769
1769
|
# creation
|
1770
1770
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1771
1771
|
with(basic_auth: ['john', 'doe']).
|
1772
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1772
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1773
1773
|
# check if alias exists
|
1774
1774
|
stub_request(:head, "https://logs.google.com:777/es//_alias/logstash").
|
1775
1775
|
with(basic_auth: ['john', 'doe']).
|
1776
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1776
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1777
1777
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1778
1778
|
with(basic_auth: ['john', 'doe']).
|
1779
|
-
to_return(status: 404, body: "", headers: {})
|
1779
|
+
to_return(status: 404, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1780
1780
|
if use_legacy_template_flag
|
1781
1781
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1782
1782
|
with(basic_auth: ['john', 'doe'],
|
1783
1783
|
body: "{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"fluentd-policy\",\"index.lifecycle.rollover_alias\":\"myalogs\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}},\"index_patterns\":\"mylogs-*\",\"order\":51}").
|
1784
|
-
to_return(status: 200, body: "", headers: {})
|
1784
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1785
1785
|
else
|
1786
1786
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1787
1787
|
with(basic_auth: ['john', 'doe'],
|
1788
1788
|
body: "{\"index_patterns\":\"logstash-*\",\"template\":{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"fluentd-policy\",\"index.lifecycle.rollover_alias\":\"logstash\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}}},\"priority\":101}").
|
1789
|
-
to_return(status: 200, body: "", headers: {})
|
1789
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1790
1790
|
end
|
1791
1791
|
# put the alias for the index
|
1792
1792
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash-default-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E").
|
1793
1793
|
with(basic_auth: ['john', 'doe']).
|
1794
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1794
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1795
1795
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash-default-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E/#{alias_endpoint}/logstash").
|
1796
1796
|
with(body: "{\"aliases\":{\"logstash\":{\"is_write_index\":true}}}").
|
1797
|
-
to_return(status: 200, body: "", headers: {})
|
1797
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1798
1798
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
1799
1799
|
with(basic_auth: ['john', 'doe']).
|
1800
|
-
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
1800
|
+
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json", 'x-elastic-product' => 'Elasticsearch'})
|
1801
1801
|
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
1802
1802
|
with(basic_auth: ['john', 'doe']).
|
1803
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1803
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1804
1804
|
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
1805
1805
|
with(basic_auth: ['john', 'doe'],
|
1806
1806
|
body: "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"70gb\",\"max_age\":\"30d\"}}}}}}").
|
1807
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1807
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1808
1808
|
stub_elastic_info("https://logs.google.com:777/es//")
|
1809
1809
|
|
1810
1810
|
driver(config)
|
@@ -1852,50 +1852,50 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1852
1852
|
# connection start
|
1853
1853
|
stub_request(:head, "https://logs.google.com:777/es//").
|
1854
1854
|
with(basic_auth: ['john', 'doe']).
|
1855
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1855
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1856
1856
|
# check if template exists
|
1857
1857
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1858
1858
|
with(basic_auth: ['john', 'doe']).
|
1859
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1859
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1860
1860
|
# creation
|
1861
1861
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1862
1862
|
with(basic_auth: ['john', 'doe']).
|
1863
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1863
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1864
1864
|
# check if alias exists
|
1865
1865
|
stub_request(:head, "https://logs.google.com:777/es//_alias/logstash").
|
1866
1866
|
with(basic_auth: ['john', 'doe']).
|
1867
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1867
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1868
1868
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1869
1869
|
with(basic_auth: ['john', 'doe']).
|
1870
|
-
to_return(status: 404, body: "", headers: {})
|
1870
|
+
to_return(status: 404, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1871
1871
|
if use_legacy_template_flag
|
1872
1872
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1873
1873
|
with(basic_auth: ['john', 'doe'],
|
1874
1874
|
body: "{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"fluentd-policy2\",\"index.lifecycle.rollover_alias\":\"logstash\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}},\"index_patterns\":\"logstash-*\",\"order\":51}").
|
1875
|
-
to_return(status: 200, body: "", headers: {})
|
1875
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1876
1876
|
else
|
1877
1877
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1878
1878
|
with(basic_auth: ['john', 'doe'],
|
1879
1879
|
body: "{\"index_patterns\":\"logstash-*\",\"template\":{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"fluentd-policy2\",\"index.lifecycle.rollover_alias\":\"logstash\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}}},\"priority\":101}").
|
1880
|
-
to_return(status: 200, body: "", headers: {})
|
1880
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1881
1881
|
end
|
1882
1882
|
# put the alias for the index
|
1883
1883
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash-default-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E").
|
1884
1884
|
with(basic_auth: ['john', 'doe']).
|
1885
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1885
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1886
1886
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash-default-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E/#{alias_endpoint}/logstash").
|
1887
1887
|
with(body: "{\"aliases\":{\"logstash\":{\"is_write_index\":true}}}").
|
1888
|
-
to_return(status: 200, body: "", headers: {})
|
1888
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1889
1889
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
1890
1890
|
with(basic_auth: ['john', 'doe']).
|
1891
|
-
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
1891
|
+
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json", 'x-elastic-product' => 'Elasticsearch'})
|
1892
1892
|
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy2").
|
1893
1893
|
with(basic_auth: ['john', 'doe']).
|
1894
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1894
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1895
1895
|
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy2").
|
1896
1896
|
with(basic_auth: ['john', 'doe'],
|
1897
1897
|
body: "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"80gb\",\"max_age\":\"20d\"}}}}}}").
|
1898
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1898
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1899
1899
|
stub_elastic_info("https://logs.google.com:777/es//")
|
1900
1900
|
|
1901
1901
|
driver(config)
|
@@ -1942,86 +1942,86 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
1942
1942
|
# connection start
|
1943
1943
|
stub_request(:head, "https://logs.google.com:777/es//").
|
1944
1944
|
with(basic_auth: ['john', 'doe']).
|
1945
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1945
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1946
1946
|
# check if template exists
|
1947
1947
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1948
1948
|
with(basic_auth: ['john', 'doe']).
|
1949
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1949
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1950
1950
|
# creation
|
1951
1951
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
1952
1952
|
with(basic_auth: ['john', 'doe']).
|
1953
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1953
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1954
1954
|
# check if alias exists
|
1955
1955
|
stub_request(:head, "https://logs.google.com:777/es//_alias/logstash-tag1").
|
1956
1956
|
with(basic_auth: ['john', 'doe']).
|
1957
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1957
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1958
1958
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash-tag1").
|
1959
1959
|
with(basic_auth: ['john', 'doe']).
|
1960
|
-
to_return(status: 404, body: "", headers: {})
|
1960
|
+
to_return(status: 404, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1961
1961
|
if use_legacy_template_flag
|
1962
1962
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash-tag1").
|
1963
1963
|
with(basic_auth: ['john', 'doe'],
|
1964
1964
|
body: "{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"logstash-policy\",\"index.lifecycle.rollover_alias\":\"logstash-tag1\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}},\"index_patterns\":\"logstash-tag1-*\",\"order\":52}").
|
1965
|
-
to_return(status: 200, body: "", headers: {})
|
1965
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1966
1966
|
else
|
1967
1967
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash-tag1").
|
1968
1968
|
with(basic_auth: ['john', 'doe'],
|
1969
1969
|
body: "{\"index_patterns\":\"logstash-tag1-*\",\"template\":{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"logstash-policy\",\"index.lifecycle.rollover_alias\":\"logstash-tag1\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}}},\"priority\":102}").
|
1970
|
-
to_return(status: 200, body: "", headers: {})
|
1970
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1971
1971
|
end
|
1972
1972
|
# put the alias for the index
|
1973
1973
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash-tag1-default-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E").
|
1974
1974
|
with(basic_auth: ['john', 'doe']).
|
1975
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1975
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1976
1976
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash-tag1-default-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E/#{alias_endpoint}/logstash-tag1").
|
1977
1977
|
with(basic_auth: ['john', 'doe'],
|
1978
1978
|
:body => "{\"aliases\":{\"logstash-tag1\":{\"is_write_index\":true}}}").
|
1979
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1979
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1980
1980
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
1981
1981
|
with(basic_auth: ['john', 'doe']).
|
1982
|
-
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
1982
|
+
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json", 'x-elastic-product' => 'Elasticsearch'})
|
1983
1983
|
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
1984
1984
|
with(basic_auth: ['john', 'doe']).
|
1985
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1985
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1986
1986
|
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
1987
1987
|
with(basic_auth: ['john', 'doe'],
|
1988
1988
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
1989
|
-
to_return(:status => 200, :body => "", :headers => {})
|
1989
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1990
1990
|
# check if alias exists
|
1991
1991
|
stub_request(:head, "https://logs.google.com:777/es//_alias/logstash-tag2").
|
1992
1992
|
with(basic_auth: ['john', 'doe']).
|
1993
|
-
to_return(:status => 404, :body => "", :headers => {})
|
1993
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
1994
1994
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash-tag2").
|
1995
1995
|
with(basic_auth: ['john', 'doe']).
|
1996
|
-
to_return(status: 404, body: "", headers: {})
|
1996
|
+
to_return(status: 404, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
1997
1997
|
if use_legacy_template_flag
|
1998
1998
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash-tag2").
|
1999
1999
|
with(basic_auth: ['john', 'doe'],
|
2000
2000
|
body: "{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"logstash-policy\",\"index.lifecycle.rollover_alias\":\"logstash-tag2\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}},\"index_patterns\":\"logstash-tag2-*\",\"order\":52}").
|
2001
|
-
to_return(status: 200, body: "", headers: {})
|
2001
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
2002
2002
|
else
|
2003
2003
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash-tag2").
|
2004
2004
|
with(basic_auth: ['john', 'doe'],
|
2005
2005
|
body: "{\"index_patterns\":\"logstash-tag2-*\",\"template\":{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"logstash-policy\",\"index.lifecycle.rollover_alias\":\"logstash-tag2\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}}},\"priority\":102}").
|
2006
|
-
to_return(status: 200, body: "", headers: {})
|
2006
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
2007
2007
|
end # put the alias for the index
|
2008
2008
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash-tag2-default-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E").
|
2009
2009
|
with(basic_auth: ['john', 'doe']).
|
2010
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2010
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2011
2011
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash-tag2-default-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E/#{alias_endpoint}/logstash-tag2").
|
2012
2012
|
with(basic_auth: ['john', 'doe'],
|
2013
2013
|
:body => "{\"aliases\":{\"logstash-tag2\":{\"is_write_index\":true}}}").
|
2014
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2014
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2015
2015
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
2016
2016
|
with(basic_auth: ['john', 'doe']).
|
2017
|
-
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
2017
|
+
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json", 'x-elastic-product' => 'Elasticsearch'})
|
2018
2018
|
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
2019
2019
|
with(basic_auth: ['john', 'doe']).
|
2020
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2020
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2021
2021
|
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
2022
2022
|
with(basic_auth: ['john', 'doe'],
|
2023
2023
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
2024
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2024
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2025
2025
|
stub_elastic_info("https://logs.google.com:777/es//")
|
2026
2026
|
|
2027
2027
|
driver(config)
|
@@ -2074,51 +2074,51 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2074
2074
|
# connection start
|
2075
2075
|
stub_request(:head, "https://logs.google.com:777/es//").
|
2076
2076
|
with(basic_auth: ['john', 'doe']).
|
2077
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2077
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2078
2078
|
# check if template exists
|
2079
2079
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
2080
2080
|
with(basic_auth: ['john', 'doe']).
|
2081
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2081
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2082
2082
|
# creation
|
2083
2083
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
2084
2084
|
with(basic_auth: ['john', 'doe']).
|
2085
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2085
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2086
2086
|
# check if alias exists
|
2087
2087
|
stub_request(:head, "https://logs.google.com:777/es//_alias/logstash.tag1").
|
2088
2088
|
with(basic_auth: ['john', 'doe']).
|
2089
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2089
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2090
2090
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash.tag1").
|
2091
2091
|
with(basic_auth: ['john', 'doe']).
|
2092
|
-
to_return(status: 404, body: "", headers: {})
|
2092
|
+
to_return(status: 404, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
2093
2093
|
if use_legacy_template_flag
|
2094
2094
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash.tag1").
|
2095
2095
|
with(basic_auth: ['john', 'doe'],
|
2096
2096
|
body: "{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"logstash-policy\",\"index.lifecycle.rollover_alias\":\"logstash.tag1\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}},\"index_patterns\":\"logstash.tag1.*\",\"order\":52}").
|
2097
|
-
to_return(status: 200, body: "", headers: {})
|
2097
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
2098
2098
|
else
|
2099
2099
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash.tag1").
|
2100
2100
|
with(basic_auth: ['john', 'doe'],
|
2101
2101
|
body: "{\"index_patterns\":\"logstash.tag1.*\",\"template\":{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"logstash-policy\",\"index.lifecycle.rollover_alias\":\"logstash.tag1\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}}},\"priority\":102}").
|
2102
|
-
to_return(status: 200, body: "", headers: {})
|
2102
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
2103
2103
|
end
|
2104
2104
|
# put the alias for the index
|
2105
2105
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash.tag1.default-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E").
|
2106
2106
|
with(basic_auth: ['john', 'doe']).
|
2107
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2107
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2108
2108
|
stub_request(:put, "https://logs.google.com:777/es//%3Clogstash.tag1.default-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E/#{alias_endpoint}/logstash.tag1").
|
2109
2109
|
with(basic_auth: ['john', 'doe'],
|
2110
2110
|
:body => "{\"aliases\":{\"logstash.tag1\":{\"is_write_index\":true}}}").
|
2111
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2111
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2112
2112
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
2113
2113
|
with(basic_auth: ['john', 'doe']).
|
2114
|
-
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
2114
|
+
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json", 'x-elastic-product' => 'Elasticsearch'})
|
2115
2115
|
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
2116
2116
|
with(basic_auth: ['john', 'doe']).
|
2117
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2117
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2118
2118
|
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
2119
2119
|
with(basic_auth: ['john', 'doe'],
|
2120
2120
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
2121
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2121
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2122
2122
|
stub_elastic_info("https://logs.google.com:777/es//")
|
2123
2123
|
|
2124
2124
|
driver(config)
|
@@ -2177,45 +2177,45 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2177
2177
|
# connection start
|
2178
2178
|
stub_request(:head, "https://logs.google.com:777/es//").
|
2179
2179
|
with(basic_auth: ['john', 'doe']).
|
2180
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2180
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2181
2181
|
# check if template exists
|
2182
2182
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/#{task_def_value}-#{date_str}").
|
2183
2183
|
with(basic_auth: ['john', 'doe']).
|
2184
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2184
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2185
2185
|
# creation
|
2186
2186
|
if use_legacy_template_flag
|
2187
2187
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/#{task_def_value}-#{date_str}").
|
2188
2188
|
with(basic_auth: ['john', 'doe'],
|
2189
2189
|
body: "{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"logstash-policy\",\"index.lifecycle.rollover_alias\":\"#{task_def_value}-#{date_str}\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}},\"index_patterns\":\"#{task_def_value}-#{date_str}-*\",\"order\":52}").
|
2190
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2190
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2191
2191
|
else
|
2192
2192
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/#{task_def_value}-#{date_str}").
|
2193
2193
|
with(basic_auth: ['john', 'doe'],
|
2194
2194
|
body: "{\"index_patterns\":\"task_definition-#{date_str}-*\",\"template\":{\"settings\":{\"number_of_shards\":1,\"index.lifecycle.name\":\"logstash-policy\",\"index.lifecycle.rollover_alias\":\"task_definition-#{date_str}\"},\"mappings\":{\"type1\":{\"_source\":{\"enabled\":false},\"properties\":{\"host_name\":{\"type\":\"string\",\"index\":\"not_analyzed\"},\"created_at\":{\"type\":\"date\",\"format\":\"EEE MMM dd HH:mm:ss Z YYYY\"}}}}},\"priority\":102}").
|
2195
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2195
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2196
2196
|
end
|
2197
2197
|
# check if alias exists
|
2198
2198
|
stub_request(:head, "https://logs.google.com:777/es//_alias/#{task_def_value}-#{date_str}").
|
2199
2199
|
with(basic_auth: ['john', 'doe']).
|
2200
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2200
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2201
2201
|
# put the alias for the index
|
2202
2202
|
stub_request(:put, "https://logs.google.com:777/es//%3C#{task_def_value}-#{date_str}-default-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E").
|
2203
2203
|
with(basic_auth: ['john', 'doe']).
|
2204
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2204
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2205
2205
|
stub_request(:put, "https://logs.google.com:777/es//%3C#{task_def_value}-#{date_str}-default-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E/#{alias_endpoint}/#{task_def_value}-#{date_str}").
|
2206
2206
|
with(basic_auth: ['john', 'doe'],
|
2207
2207
|
:body => "{\"aliases\":{\"#{task_def_value}-#{date_str}\":{\"is_write_index\":true}}}").
|
2208
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2208
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2209
2209
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
2210
2210
|
with(basic_auth: ['john', 'doe']).
|
2211
|
-
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
2211
|
+
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json", 'x-elastic-product' => 'Elasticsearch'})
|
2212
2212
|
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
2213
2213
|
with(basic_auth: ['john', 'doe']).
|
2214
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2214
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2215
2215
|
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/logstash-policy").
|
2216
2216
|
with(basic_auth: ['john', 'doe'],
|
2217
2217
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
2218
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2218
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2219
2219
|
stub_elastic_info("https://logs.google.com:777/es//")
|
2220
2220
|
|
2221
2221
|
driver(config)
|
@@ -2263,15 +2263,15 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2263
2263
|
# connection start
|
2264
2264
|
stub_request(:head, "https://logs.google.com:777/es//").
|
2265
2265
|
with(basic_auth: ['john', 'doe']).
|
2266
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2266
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2267
2267
|
# check if template exists
|
2268
2268
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template").
|
2269
2269
|
with(basic_auth: ['john', 'doe']).
|
2270
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2270
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2271
2271
|
# creation
|
2272
2272
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template").
|
2273
2273
|
with(basic_auth: ['john', 'doe']).
|
2274
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2274
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2275
2275
|
stub_elastic_info("https://logs.google.com:777/es//")
|
2276
2276
|
|
2277
2277
|
driver(config)
|
@@ -2309,18 +2309,18 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2309
2309
|
# connection start
|
2310
2310
|
stub_request(:head, "https://logs.google.com:777/es//").
|
2311
2311
|
with(basic_auth: ['john', 'doe']).
|
2312
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2312
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2313
2313
|
# check if template exists
|
2314
2314
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template-test.template").
|
2315
2315
|
with(basic_auth: ['john', 'doe']).
|
2316
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2316
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2317
2317
|
# creation
|
2318
2318
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template-test.template").
|
2319
2319
|
with(basic_auth: ['john', 'doe']).
|
2320
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2320
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2321
2321
|
|
2322
2322
|
stub_request(:put, "https://logs.google.com:777/es//%3Cfluentd-test-default-000001%3E").
|
2323
|
-
to_return(status: 200, body: "", headers: {})
|
2323
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
2324
2324
|
|
2325
2325
|
driver(config)
|
2326
2326
|
|
@@ -2365,14 +2365,14 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2365
2365
|
# connection start
|
2366
2366
|
stub_request(:head, "https://logs-test.google.com:777/es//").
|
2367
2367
|
with(basic_auth: ['john', 'doe']).
|
2368
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2368
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2369
2369
|
# check if template exists
|
2370
2370
|
stub_request(:get, "https://logs-test.google.com:777/es//#{endpoint}/logstash").
|
2371
2371
|
with(basic_auth: ['john', 'doe']).
|
2372
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2372
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2373
2373
|
stub_request(:put, "https://logs-test.google.com:777/es//#{endpoint}/logstash").
|
2374
2374
|
with(basic_auth: ['john', 'doe']).
|
2375
|
-
to_return(status: 200, body: "", headers: {})
|
2375
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
2376
2376
|
|
2377
2377
|
driver(config)
|
2378
2378
|
|
@@ -2417,27 +2417,27 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2417
2417
|
# connection start
|
2418
2418
|
stub_request(:head, "https://logs.google.com:777/es//").
|
2419
2419
|
with(basic_auth: ['john', 'doe']).
|
2420
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2420
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2421
2421
|
# check if template exists
|
2422
2422
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template").
|
2423
2423
|
with(basic_auth: ['john', 'doe']).
|
2424
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2424
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2425
2425
|
# creation
|
2426
2426
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template").
|
2427
2427
|
with(basic_auth: ['john', 'doe']).
|
2428
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2428
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2429
2429
|
# creation of index which can rollover
|
2430
2430
|
stub_request(:put, "https://logs.google.com:777/es//%3Cmylogs-myapp-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E").
|
2431
2431
|
with(basic_auth: ['john', 'doe']).
|
2432
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2432
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2433
2433
|
# check if alias exists
|
2434
2434
|
stub_request(:head, "https://logs.google.com:777/es//_alias/mylogs").
|
2435
2435
|
with(basic_auth: ['john', 'doe']).
|
2436
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2436
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2437
2437
|
# put the alias for the index
|
2438
2438
|
stub_request(:put, "https://logs.google.com:777/es//%3Cmylogs-myapp-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E/#{alias_endpoint}/mylogs").
|
2439
2439
|
with(basic_auth: ['john', 'doe']).
|
2440
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2440
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2441
2441
|
stub_elastic_info("https://logs.google.com:777/es//")
|
2442
2442
|
|
2443
2443
|
driver(config)
|
@@ -2480,27 +2480,27 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2480
2480
|
# connection start
|
2481
2481
|
stub_request(:head, "https://logs.google.com:777/es//").
|
2482
2482
|
with(basic_auth: ['john', 'doe']).
|
2483
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2483
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2484
2484
|
# check if template exists
|
2485
2485
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template").
|
2486
2486
|
with(basic_auth: ['john', 'doe']).
|
2487
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2487
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2488
2488
|
# creation
|
2489
2489
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template").
|
2490
2490
|
with(basic_auth: ['john', 'doe']).
|
2491
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2491
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2492
2492
|
# creation of index which can rollover
|
2493
2493
|
stub_request(:put, "https://logs.google.com:777/es//%3Cmylogs-myapp-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E").
|
2494
2494
|
with(basic_auth: ['john', 'doe']).
|
2495
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2495
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2496
2496
|
# check if alias exists
|
2497
2497
|
stub_request(:head, "https://logs.google.com:777/es//_alias/myapp_deflector").
|
2498
2498
|
with(basic_auth: ['john', 'doe']).
|
2499
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2499
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2500
2500
|
# put the alias for the index
|
2501
2501
|
stub_request(:put, "https://logs.google.com:777/es//%3Cmylogs-myapp-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E/#{alias_endpoint}/myapp_deflector").
|
2502
2502
|
with(basic_auth: ['john', 'doe']).
|
2503
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2503
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2504
2504
|
stub_elastic_info("https://logs.google.com:777/es//")
|
2505
2505
|
|
2506
2506
|
driver(config)
|
@@ -2544,28 +2544,28 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2544
2544
|
# connection start
|
2545
2545
|
stub_request(:head, "https://logs.google.com:777/es//").
|
2546
2546
|
with(basic_auth: ['john', 'doe']).
|
2547
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2547
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2548
2548
|
# check if template exists
|
2549
2549
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template").
|
2550
2550
|
with(basic_auth: ['john', 'doe']).
|
2551
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2551
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2552
2552
|
# creation
|
2553
2553
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template").
|
2554
2554
|
with(basic_auth: ['john', 'doe']).
|
2555
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2555
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2556
2556
|
# creation of index which can rollover
|
2557
2557
|
stub_request(:put, "https://logs.google.com:777/es//%3Cmylogs-myapp-#{timestr}-000001%3E").
|
2558
2558
|
with(basic_auth: ['john', 'doe']).
|
2559
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2559
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2560
2560
|
# check if alias exists
|
2561
2561
|
stub_request(:head, "https://logs.google.com:777/es//_alias/mylogs-#{timestr}").
|
2562
2562
|
with(basic_auth: ['john', 'doe']).
|
2563
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2563
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2564
2564
|
# put the alias for the index
|
2565
2565
|
stub_request(:put, "https://logs.google.com:777/es//%3Cmylogs-myapp-#{timestr}-000001%3E/#{alias_endpoint}/mylogs-#{timestr}").
|
2566
2566
|
with(basic_auth: ['john', 'doe'],
|
2567
2567
|
body: "{\"aliases\":{\"mylogs-#{timestr}\":{\"is_write_index\":true}}}").
|
2568
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2568
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2569
2569
|
|
2570
2570
|
driver(config)
|
2571
2571
|
|
@@ -2593,11 +2593,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2593
2593
|
|
2594
2594
|
|
2595
2595
|
def ilm_endpoint
|
2596
|
-
|
2597
|
-
'_enrich'.freeze
|
2598
|
-
else
|
2599
|
-
'_ilm'.freeze
|
2600
|
-
end
|
2596
|
+
'_ilm'.freeze
|
2601
2597
|
end
|
2602
2598
|
|
2603
2599
|
data("legacy_template" => [true, "_template"],
|
@@ -2635,52 +2631,52 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2635
2631
|
# connection start
|
2636
2632
|
stub_request(:head, "https://logs.google.com:777/es//").
|
2637
2633
|
with(basic_auth: ['john', 'doe']).
|
2638
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2634
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2639
2635
|
# check if template exists
|
2640
2636
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template").
|
2641
2637
|
with(basic_auth: ['john', 'doe']).
|
2642
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2638
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2643
2639
|
# creation
|
2644
2640
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template").
|
2645
2641
|
with(basic_auth: ['john', 'doe']).
|
2646
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2642
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2647
2643
|
# creation of index which can rollover
|
2648
2644
|
stub_request(:put, "https://logs.google.com:777/es//%3Cmylogs-myapp-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E").
|
2649
2645
|
with(basic_auth: ['john', 'doe']).
|
2650
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2646
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2651
2647
|
# check if alias exists
|
2652
2648
|
stub_request(:head, "https://logs.google.com:777/es//_alias/mylogs").
|
2653
2649
|
with(basic_auth: ['john', 'doe']).
|
2654
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2650
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2655
2651
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/mylogs").
|
2656
2652
|
with(basic_auth: ['john', 'doe']).
|
2657
|
-
to_return(status: 404, body: "", headers: {})
|
2653
|
+
to_return(status: 404, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
2658
2654
|
if use_legacy_template_flag
|
2659
2655
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/mylogs").
|
2660
2656
|
with(basic_auth: ['john', 'doe'],
|
2661
2657
|
body: "{\"order\":6,\"settings\":{\"index.lifecycle.name\":\"fluentd-policy\",\"index.lifecycle.rollover_alias\":\"mylogs\"},\"mappings\":{},\"aliases\":{\"myapp-logs-alias\":{}},\"index_patterns\":\"mylogs-*\"}").
|
2662
|
-
to_return(status: 200, body: "", headers: {})
|
2658
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
2663
2659
|
else
|
2664
2660
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/mylogs").
|
2665
2661
|
with(basic_auth: ['john', 'doe'],
|
2666
2662
|
body: "{\"priority\":106,\"index_patterns\":\"mylogs-*\",\"template\":{\"settings\":{\"index.lifecycle.name\":\"fluentd-policy\",\"index.lifecycle.rollover_alias\":\"mylogs\"},\"mappings\":{},\"aliases\":{\"myapp-logs-alias\":{}}}}").
|
2667
|
-
to_return(status: 200, body: "", headers: {})
|
2663
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
2668
2664
|
end
|
2669
2665
|
# put the alias for the index
|
2670
2666
|
stub_request(:put, "https://logs.google.com:777/es//%3Cmylogs-myapp-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E/#{alias_endpoint}/mylogs").
|
2671
2667
|
with(basic_auth: ['john', 'doe'],
|
2672
2668
|
:body => "{\"aliases\":{\"mylogs\":{\"is_write_index\":true}}}").
|
2673
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2669
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2674
2670
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
2675
2671
|
with(basic_auth: ['john', 'doe']).
|
2676
|
-
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
2672
|
+
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json", 'x-elastic-product' => 'Elasticsearch'})
|
2677
2673
|
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
2678
2674
|
with(basic_auth: ['john', 'doe']).
|
2679
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2675
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2680
2676
|
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
2681
2677
|
with(basic_auth: ['john', 'doe'],
|
2682
2678
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
2683
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2679
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2684
2680
|
stub_elastic_info("https://logs.google.com:777/es//")
|
2685
2681
|
driver(config)
|
2686
2682
|
|
@@ -2724,52 +2720,52 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2724
2720
|
# connection start
|
2725
2721
|
stub_request(:head, "https://logs.google.com:777/es//").
|
2726
2722
|
with(basic_auth: ['john', 'doe']).
|
2727
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2723
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2728
2724
|
# check if template exists
|
2729
2725
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template").
|
2730
2726
|
with(basic_auth: ['john', 'doe']).
|
2731
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2727
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2732
2728
|
# creation
|
2733
2729
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template").
|
2734
2730
|
with(basic_auth: ['john', 'doe']).
|
2735
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2731
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2736
2732
|
# creation of index which can rollover
|
2737
2733
|
stub_request(:put, "https://logs.google.com:777/es//%3Cmylogs-myapp-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E").
|
2738
2734
|
with(basic_auth: ['john', 'doe']).
|
2739
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2735
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2740
2736
|
# check if alias exists
|
2741
2737
|
stub_request(:head, "https://logs.google.com:777/es//_alias/mylogs").
|
2742
2738
|
with(basic_auth: ['john', 'doe']).
|
2743
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2739
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2744
2740
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/mylogs").
|
2745
2741
|
with(basic_auth: ['john', 'doe']).
|
2746
|
-
to_return(status: 404, body: "", headers: {})
|
2742
|
+
to_return(status: 404, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
2747
2743
|
if use_legacy_template_flag
|
2748
2744
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/mylogs").
|
2749
2745
|
with(basic_auth: ['john', 'doe'],
|
2750
2746
|
body: "{\"order\":6,\"settings\":{\"index.lifecycle.name\":\"fluentd-policy\",\"index.lifecycle.rollover_alias\":\"mylogs\"},\"mappings\":{},\"aliases\":{\"myapp-logs-alias\":{}},\"index_patterns\":\"mylogs-*\"}").
|
2751
|
-
to_return(status: 200, body: "", headers: {})
|
2747
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
2752
2748
|
else
|
2753
2749
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/mylogs").
|
2754
2750
|
with(basic_auth: ['john', 'doe'],
|
2755
2751
|
body: "{\"priority\":106,\"index_patterns\":\"mylogs-*\",\"template\":{\"settings\":{\"index.lifecycle.name\":\"fluentd-policy\",\"index.lifecycle.rollover_alias\":\"mylogs\"},\"mappings\":{},\"aliases\":{\"myapp-logs-alias\":{}}}}").
|
2756
|
-
to_return(status: 200, body: "", headers: {})
|
2752
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
2757
2753
|
end
|
2758
2754
|
# put the alias for the index
|
2759
2755
|
stub_request(:put, "https://logs.google.com:777/es//%3Cmylogs-myapp-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E/#{alias_endpoint}/mylogs").
|
2760
2756
|
with(basic_auth: ['john', 'doe'],
|
2761
2757
|
:body => "{\"aliases\":{\"mylogs\":{\"is_write_index\":true}}}").
|
2762
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2758
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2763
2759
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
2764
2760
|
with(basic_auth: ['john', 'doe']).
|
2765
|
-
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
2761
|
+
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json", 'x-elastic-product' => 'Elasticsearch'})
|
2766
2762
|
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
2767
2763
|
with(basic_auth: ['john', 'doe']).
|
2768
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2764
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2769
2765
|
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
2770
2766
|
with(basic_auth: ['john', 'doe'],
|
2771
2767
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"60gb\",\"max_age\":\"45d\"}}}}}}").
|
2772
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2768
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2773
2769
|
stub_elastic_info("https://logs.google.com:777/es//")
|
2774
2770
|
|
2775
2771
|
driver(config)
|
@@ -2841,101 +2837,101 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2841
2837
|
# connection start
|
2842
2838
|
stub_request(:head, "https://logs.google.com:777/es//").
|
2843
2839
|
with(basic_auth: ['john', 'doe']).
|
2844
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2840
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2845
2841
|
|
2846
2842
|
# test-tag1
|
2847
2843
|
# check if template exists
|
2848
2844
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template").
|
2849
2845
|
with(basic_auth: ['john', 'doe']).
|
2850
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2846
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2851
2847
|
# creation
|
2852
2848
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template").
|
2853
2849
|
with(basic_auth: ['john', 'doe']).
|
2854
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2850
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2855
2851
|
# creation of index which can rollover
|
2856
2852
|
stub_request(:put, "https://logs.google.com:777/es//%3Cmylogs-test-tag1-myapp-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E").
|
2857
2853
|
with(basic_auth: ['john', 'doe']).
|
2858
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2854
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2859
2855
|
# check if alias exists
|
2860
2856
|
stub_request(:head, "https://logs.google.com:777/es//_alias/mylogs-test-tag1").
|
2861
2857
|
with(basic_auth: ['john', 'doe']).
|
2862
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2858
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2863
2859
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/mylogs-test-tag1").
|
2864
2860
|
with(basic_auth: ['john', 'doe']).
|
2865
|
-
to_return(status: 404, body: "", headers: {})
|
2861
|
+
to_return(status: 404, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
2866
2862
|
if use_legacy_template_flag
|
2867
2863
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/mylogs-test-tag1").
|
2868
2864
|
with(basic_auth: ['john', 'doe'],
|
2869
2865
|
body: "{\"order\":8,\"settings\":{\"index.lifecycle.name\":\"fluentd-policy\",\"index.lifecycle.rollover_alias\":\"mylogs-test-tag1\"},\"mappings\":{},\"aliases\":{\"myapp-logs-alias\":{}},\"index_patterns\":\"mylogs-test-tag1-*\"}").
|
2870
|
-
to_return(status: 200, body: "", headers: {})
|
2866
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
2871
2867
|
else
|
2872
2868
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/mylogs-test-tag1").
|
2873
2869
|
with(basic_auth: ['john', 'doe'],
|
2874
2870
|
body: "{\"priority\":108,\"index_patterns\":\"mylogs-test-tag1-*\",\"template\":{\"settings\":{\"index.lifecycle.name\":\"fluentd-policy\",\"index.lifecycle.rollover_alias\":\"mylogs-test-tag1\"},\"mappings\":{},\"aliases\":{\"myapp-logs-alias\":{}}}}").
|
2875
|
-
to_return(status: 200, body: "", headers: {})
|
2871
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
2876
2872
|
end
|
2877
2873
|
# put the alias for the index
|
2878
2874
|
stub_request(:put, "https://logs.google.com:777/es//%3Cmylogs-test-tag1-myapp-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E/#{alias_endpoint}/mylogs-test-tag1").
|
2879
2875
|
with(basic_auth: ['john', 'doe'],
|
2880
2876
|
:body => "{\"aliases\":{\"mylogs-test-tag1\":{\"is_write_index\":true}}}").
|
2881
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2877
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2882
2878
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
2883
2879
|
with(basic_auth: ['john', 'doe']).
|
2884
|
-
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
2880
|
+
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json", 'x-elastic-product' => 'Elasticsearch'})
|
2885
2881
|
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
2886
2882
|
with(basic_auth: ['john', 'doe']).
|
2887
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2883
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2888
2884
|
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
2889
2885
|
with(basic_auth: ['john', 'doe'],
|
2890
2886
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
2891
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2887
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2892
2888
|
|
2893
2889
|
# test-tag2
|
2894
2890
|
# check if template exists
|
2895
2891
|
stub_request(:get, "https://logs.google.com:777/es//_template/myapp_alias_template").
|
2896
2892
|
with(basic_auth: ['john', 'doe']).
|
2897
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2893
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2898
2894
|
# creation
|
2899
2895
|
stub_request(:put, "https://logs.google.com:777/es//_template/myapp_alias_template").
|
2900
2896
|
with(basic_auth: ['john', 'doe']).
|
2901
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2897
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2902
2898
|
# creation of index which can rollover
|
2903
2899
|
stub_request(:put, "https://logs.google.com:777/es//%3Cmylogs-test-tag2-myapp-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E").
|
2904
2900
|
with(basic_auth: ['john', 'doe']).
|
2905
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2901
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2906
2902
|
# check if alias exists
|
2907
2903
|
stub_request(:head, "https://logs.google.com:777/es//_alias/mylogs-test-tag2").
|
2908
2904
|
with(basic_auth: ['john', 'doe']).
|
2909
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2905
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2910
2906
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/mylogs-test-tag2").
|
2911
2907
|
with(basic_auth: ['john', 'doe']).
|
2912
|
-
to_return(status: 404, body: "", headers: {})
|
2908
|
+
to_return(status: 404, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
2913
2909
|
if use_legacy_template_flag
|
2914
2910
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/mylogs-test-tag2").
|
2915
2911
|
with(basic_auth: ['john', 'doe'],
|
2916
2912
|
body: "{\"order\":8,\"settings\":{\"index.lifecycle.name\":\"fluentd-policy\",\"index.lifecycle.rollover_alias\":\"mylogs-test-tag2\"},\"mappings\":{},\"aliases\":{\"myapp-logs-alias\":{}},\"index_patterns\":\"mylogs-test-tag2-*\"}").
|
2917
|
-
to_return(status: 200, body: "", headers: {})
|
2913
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
2918
2914
|
else
|
2919
2915
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/mylogs-test-tag2").
|
2920
2916
|
with(basic_auth: ['john', 'doe'],
|
2921
2917
|
body: "{\"priority\":108,\"index_patterns\":\"mylogs-test-tag2-*\",\"template\":{\"settings\":{\"index.lifecycle.name\":\"fluentd-policy\",\"index.lifecycle.rollover_alias\":\"mylogs-test-tag2\"},\"mappings\":{},\"aliases\":{\"myapp-logs-alias\":{}}}}").
|
2922
|
-
to_return(status: 200, body: "", headers: {})
|
2918
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
2923
2919
|
end
|
2924
2920
|
# put the alias for the index
|
2925
2921
|
stub_request(:put, "https://logs.google.com:777/es//%3Cmylogs-test-tag2-myapp-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E/#{alias_endpoint}/mylogs-test-tag2").
|
2926
2922
|
with(basic_auth: ['john', 'doe'],
|
2927
2923
|
:body => "{\"aliases\":{\"mylogs-test-tag2\":{\"is_write_index\":true}}}").
|
2928
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2924
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2929
2925
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
2930
2926
|
with(basic_auth: ['john', 'doe']).
|
2931
|
-
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
2927
|
+
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json", 'x-elastic-product' => 'Elasticsearch'})
|
2932
2928
|
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
2933
2929
|
with(basic_auth: ['john', 'doe']).
|
2934
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2930
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2935
2931
|
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
2936
2932
|
with(basic_auth: ['john', 'doe'],
|
2937
2933
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"50gb\",\"max_age\":\"30d\"}}}}}}").
|
2938
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2934
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2939
2935
|
stub_elastic_info("https://logs.google.com:777/es//")
|
2940
2936
|
|
2941
2937
|
driver(config)
|
@@ -2989,44 +2985,44 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
2989
2985
|
# connection start
|
2990
2986
|
stub_request(:head, "https://logs.google.com:777/es//").
|
2991
2987
|
with(basic_auth: ['john', 'doe']).
|
2992
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2988
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2993
2989
|
# check if template exists
|
2994
2990
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template").
|
2995
2991
|
with(basic_auth: ['john', 'doe']).
|
2996
|
-
to_return(:status => 404, :body => "", :headers => {})
|
2992
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
2997
2993
|
# creation
|
2998
2994
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template").
|
2999
2995
|
with(basic_auth: ['john', 'doe']).
|
3000
|
-
to_return(:status => 200, :body => "", :headers => {})
|
2996
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3001
2997
|
# creation of index which can rollover
|
3002
2998
|
stub_request(:put, "https://logs.google.com:777/es//%3Cmylogs-myapp-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E").
|
3003
2999
|
with(basic_auth: ['john', 'doe']).
|
3004
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3000
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3005
3001
|
# check if alias exists
|
3006
3002
|
stub_request(:head, "https://logs.google.com:777/es//_alias/mylogs").
|
3007
3003
|
with(basic_auth: ['john', 'doe']).
|
3008
|
-
to_return(:status => 404, :body => "", :headers => {})
|
3004
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3009
3005
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/mylogs").
|
3010
3006
|
with(basic_auth: ['john', 'doe']).
|
3011
|
-
to_return(status: 404, body: "", headers: {})
|
3007
|
+
to_return(status: 404, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
3012
3008
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/mylogs").
|
3013
3009
|
with(basic_auth: ['john', 'doe']).
|
3014
|
-
to_return(status: 200, body: "", headers: {})
|
3010
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
3015
3011
|
# put the alias for the index
|
3016
3012
|
stub_request(:put, "https://logs.google.com:777/es//%3Cmylogs-myapp-%7Bnow%2Fw%7Bxxxx.ww%7D%7D-000001%3E/#{alias_endpoint}/mylogs").
|
3017
3013
|
with(basic_auth: ['john', 'doe'],
|
3018
3014
|
:body => "{\"aliases\":{\"mylogs\":{\"is_write_index\":true}}}").
|
3019
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3015
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3020
3016
|
stub_request(:get, "https://logs.google.com:777/es//_xpack").
|
3021
3017
|
with(basic_auth: ['john', 'doe']).
|
3022
|
-
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json"})
|
3018
|
+
to_return(:status => 200, :body => '{"features":{"ilm":{"available":true,"enabled":true}}}', :headers => {"Content-Type"=> "application/json", 'x-elastic-product' => 'Elasticsearch'})
|
3023
3019
|
stub_request(:get, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
3024
3020
|
with(basic_auth: ['john', 'doe']).
|
3025
|
-
to_return(:status => 404, :body => "", :headers => {})
|
3021
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3026
3022
|
stub_request(:put, "https://logs.google.com:777/es//#{ilm_endpoint}/policy/fluentd-policy").
|
3027
3023
|
with(basic_auth: ['john', 'doe'],
|
3028
3024
|
:body => "{\"policy\":{\"phases\":{\"hot\":{\"actions\":{\"rollover\":{\"max_size\":\"70gb\",\"max_age\":\"30d\"}}}}}}").
|
3029
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3025
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3030
3026
|
stub_elastic_info("https://logs.google.com:777/es//")
|
3031
3027
|
driver(config)
|
3032
3028
|
|
@@ -3064,15 +3060,15 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3064
3060
|
# connection start
|
3065
3061
|
stub_request(:head, "https://logs.google.com:777/es//").
|
3066
3062
|
with(basic_auth: ['john', 'doe']).
|
3067
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3063
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3068
3064
|
# check if template exists
|
3069
3065
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
3070
3066
|
with(basic_auth: ['john', 'doe']).
|
3071
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3067
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3072
3068
|
# creation
|
3073
3069
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
3074
3070
|
with(basic_auth: ['john', 'doe']).
|
3075
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3071
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3076
3072
|
stub_elastic_info("https://logs.google.com:777/es//")
|
3077
3073
|
|
3078
3074
|
driver(config)
|
@@ -3111,15 +3107,15 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3111
3107
|
# connection start
|
3112
3108
|
stub_request(:head, "https://logs.google.com:777/es//").
|
3113
3109
|
with(basic_auth: ['john', 'doe']).
|
3114
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3110
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3115
3111
|
# check if template exists
|
3116
3112
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template").
|
3117
3113
|
with(basic_auth: ['john', 'doe']).
|
3118
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3114
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3119
3115
|
# creation
|
3120
3116
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template").
|
3121
3117
|
with(basic_auth: ['john', 'doe']).
|
3122
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3118
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3123
3119
|
stub_elastic_info("https://logs.google.com:777/es//")
|
3124
3120
|
|
3125
3121
|
driver(config)
|
@@ -3162,27 +3158,27 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3162
3158
|
# connection start
|
3163
3159
|
stub_request(:head, "https://logs.google.com:777/es//").
|
3164
3160
|
with(basic_auth: ['john', 'doe']).
|
3165
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3161
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3166
3162
|
# check if template exists
|
3167
3163
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template").
|
3168
3164
|
with(basic_auth: ['john', 'doe']).
|
3169
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3165
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3170
3166
|
# creation
|
3171
3167
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/myapp_alias_template").
|
3172
3168
|
with(basic_auth: ['john', 'doe']).
|
3173
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3169
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3174
3170
|
# creation of index which can rollover
|
3175
3171
|
stub_request(:put, "https://logs.google.com:777/es//%3Cmylogs-myapp-%7Bnow%2Fd%7D-000001%3E").
|
3176
3172
|
with(basic_auth: ['john', 'doe']).
|
3177
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3173
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3178
3174
|
# check if alias exists
|
3179
3175
|
stub_request(:head, "https://logs.google.com:777/es//_alias/myapp_deflector").
|
3180
3176
|
with(basic_auth: ['john', 'doe']).
|
3181
|
-
to_return(:status => 404, :body => "", :headers => {})
|
3177
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3182
3178
|
# put the alias for the index
|
3183
3179
|
stub_request(:put, "https://logs.google.com:777/es//%3Cmylogs-myapp-%7Bnow%2Fd%7D-000001%3E/#{alias_endpoint}/myapp_deflector").
|
3184
3180
|
with(basic_auth: ['john', 'doe']).
|
3185
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3181
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3186
3182
|
stub_elastic_info("https://logs.google.com:777/es//")
|
3187
3183
|
|
3188
3184
|
driver(config)
|
@@ -3205,11 +3201,11 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3205
3201
|
# connection start
|
3206
3202
|
stub_request(:head, "https://logs.google.com:777/es//").
|
3207
3203
|
with(basic_auth: ['john', 'doe']).
|
3208
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3204
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3209
3205
|
# check if template exists
|
3210
3206
|
stub_request(:get, "https://logs.google.com:777/es//_template/logstash").
|
3211
3207
|
with(basic_auth: ['john', 'doe']).
|
3212
|
-
to_return(:status => 404, :body => "", :headers => {})
|
3208
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3213
3209
|
stub_elastic_info("https://logs.google.com:777/es//")
|
3214
3210
|
|
3215
3211
|
assert_raise(RuntimeError) {
|
@@ -3248,17 +3244,17 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3248
3244
|
# connection start
|
3249
3245
|
stub_request(:head, "https://logs-test.google.com:777/es//").
|
3250
3246
|
with(basic_auth: ['john', 'doe']).
|
3251
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3247
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3252
3248
|
# check if template exists
|
3253
3249
|
stub_request(:get, "https://logs-test.google.com:777/es//#{endpoint}/logstash").
|
3254
3250
|
with(basic_auth: ['john', 'doe']).
|
3255
|
-
to_return(:status => 404, :body => "", :headers => {})
|
3251
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3256
3252
|
stub_request(:put, "https://logs-test.google.com:777/es//#{endpoint}/logstash").
|
3257
3253
|
with(basic_auth: ['john', 'doe']).
|
3258
|
-
to_return(status: 200, body: "", headers: {})
|
3254
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
3259
3255
|
stub_request(:post, "https://logs-test.google.com:777/es//_bulk").
|
3260
3256
|
with(basic_auth: ['john', 'doe']).
|
3261
|
-
to_return(status: 200, body: "", headers: {})
|
3257
|
+
to_return(status: 200, body: "", headers: {'x-elastic-product' => 'Elasticsearch'})
|
3262
3258
|
|
3263
3259
|
driver(config)
|
3264
3260
|
|
@@ -3339,28 +3335,28 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3339
3335
|
|
3340
3336
|
stub_request(:head, "https://logs.google.com:777/es//").
|
3341
3337
|
with(basic_auth: ['john', 'doe']).
|
3342
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3338
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3343
3339
|
# check if template exists
|
3344
3340
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash1").
|
3345
3341
|
with(basic_auth: ['john', 'doe']).
|
3346
|
-
to_return(:status => 404, :body => "", :headers => {})
|
3342
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3347
3343
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash2").
|
3348
3344
|
with(basic_auth: ['john', 'doe']).
|
3349
|
-
to_return(:status => 404, :body => "", :headers => {})
|
3345
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3350
3346
|
|
3351
3347
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash3").
|
3352
3348
|
with(basic_auth: ['john', 'doe']).
|
3353
|
-
to_return(:status => 200, :body => "", :headers => {}) #exists
|
3349
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'}) #exists
|
3354
3350
|
|
3355
3351
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash1").
|
3356
3352
|
with(basic_auth: ['john', 'doe']).
|
3357
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3353
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3358
3354
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash2").
|
3359
3355
|
with(basic_auth: ['john', 'doe']).
|
3360
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3356
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3361
3357
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash3").
|
3362
3358
|
with(basic_auth: ['john', 'doe']).
|
3363
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3359
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3364
3360
|
stub_elastic_info("https://logs.google.com:777/es//")
|
3365
3361
|
|
3366
3362
|
driver(config)
|
@@ -3398,27 +3394,27 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3398
3394
|
|
3399
3395
|
stub_request(:head, "https://logs.google.com:777/es//").
|
3400
3396
|
with(basic_auth: ['john', 'doe']).
|
3401
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3397
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3402
3398
|
# check if template exists
|
3403
3399
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash1").
|
3404
3400
|
with(basic_auth: ['john', 'doe']).
|
3405
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3401
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3406
3402
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash2").
|
3407
3403
|
with(basic_auth: ['john', 'doe']).
|
3408
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3404
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3409
3405
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash3").
|
3410
3406
|
with(basic_auth: ['john', 'doe']).
|
3411
|
-
to_return(:status => 200, :body => "", :headers => {}) #exists
|
3407
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'}) #exists
|
3412
3408
|
|
3413
3409
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash1").
|
3414
3410
|
with(basic_auth: ['john', 'doe']).
|
3415
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3411
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3416
3412
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash2").
|
3417
3413
|
with(basic_auth: ['john', 'doe']).
|
3418
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3414
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3419
3415
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash3").
|
3420
3416
|
with(basic_auth: ['john', 'doe']).
|
3421
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3417
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3422
3418
|
stub_elastic_info("https://logs.google.com:777/es//")
|
3423
3419
|
|
3424
3420
|
driver(config)
|
@@ -3457,27 +3453,27 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3457
3453
|
# connection start
|
3458
3454
|
stub_request(:head, "https://logs.google.com:777/es//").
|
3459
3455
|
with(basic_auth: ['john', 'doe']).
|
3460
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3456
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3461
3457
|
# check if template exists
|
3462
3458
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
3463
3459
|
with(basic_auth: ['john', 'doe']).
|
3464
|
-
to_return(:status => 404, :body => "", :headers => {})
|
3460
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3465
3461
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash1").
|
3466
3462
|
with(basic_auth: ['john', 'doe']).
|
3467
|
-
to_return(:status => 404, :body => "", :headers => {})
|
3463
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3468
3464
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash2").
|
3469
3465
|
with(basic_auth: ['john', 'doe']).
|
3470
|
-
to_return(:status => 404, :body => "", :headers => {})
|
3466
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3471
3467
|
#creation
|
3472
3468
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash").
|
3473
3469
|
with(basic_auth: ['john', 'doe']).
|
3474
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3470
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3475
3471
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash1").
|
3476
3472
|
with(basic_auth: ['john', 'doe']).
|
3477
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3473
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3478
3474
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash2").
|
3479
3475
|
with(basic_auth: ['john', 'doe']).
|
3480
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3476
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3481
3477
|
stub_elastic_info("https://logs.google.com:777/es//")
|
3482
3478
|
|
3483
3479
|
driver(config)
|
@@ -3514,21 +3510,21 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3514
3510
|
}
|
3515
3511
|
stub_request(:head, "https://logs.google.com:777/es//").
|
3516
3512
|
with(basic_auth: ['john', 'doe']).
|
3517
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3513
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3518
3514
|
# check if template exists
|
3519
3515
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash1").
|
3520
3516
|
with(basic_auth: ['john', 'doe']).
|
3521
|
-
to_return(:status => 404, :body => "", :headers => {})
|
3517
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3522
3518
|
stub_request(:get, "https://logs.google.com:777/es//#{endpoint}/logstash2").
|
3523
3519
|
with(basic_auth: ['john', 'doe']).
|
3524
|
-
to_return(:status => 404, :body => "", :headers => {})
|
3520
|
+
to_return(:status => 404, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3525
3521
|
|
3526
3522
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash1").
|
3527
3523
|
with(basic_auth: ['john', 'doe']).
|
3528
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3524
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3529
3525
|
stub_request(:put, "https://logs.google.com:777/es//#{endpoint}/logstash2").
|
3530
3526
|
with(basic_auth: ['john', 'doe']).
|
3531
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3527
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3532
3528
|
stub_elastic_info("https://logs.google.com:777/es//")
|
3533
3529
|
|
3534
3530
|
assert_raise(RuntimeError) {
|
@@ -3592,6 +3588,33 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3592
3588
|
assert_equal '/default_path', host2[:path]
|
3593
3589
|
end
|
3594
3590
|
|
3591
|
+
def test_hosts_list_with_existing_connection
|
3592
|
+
stub_elastic_info("https://john:password@host1:443/elastic/")
|
3593
|
+
stub_elastic_info("http://host2")
|
3594
|
+
config = %{
|
3595
|
+
path /default_path
|
3596
|
+
user default_user
|
3597
|
+
password default_password
|
3598
|
+
}
|
3599
|
+
instance = driver(config).instance
|
3600
|
+
|
3601
|
+
assert_equal 2, instance.get_connection_options("https://john:password@host1:443/elastic/,http://host2")[:hosts].length
|
3602
|
+
host1, host2 = instance.get_connection_options("https://john:password@host1:443/elastic/,http://host2")[:hosts]
|
3603
|
+
|
3604
|
+
assert_equal 'host1', host1[:host]
|
3605
|
+
assert_equal 443, host1[:port]
|
3606
|
+
assert_equal 'https', host1[:scheme]
|
3607
|
+
assert_equal 'john', host1[:user]
|
3608
|
+
assert_equal 'password', host1[:password]
|
3609
|
+
assert_equal '/elastic/', host1[:path]
|
3610
|
+
|
3611
|
+
assert_equal 'host2', host2[:host]
|
3612
|
+
assert_equal 'http', host2[:scheme]
|
3613
|
+
assert_equal 'default_user', host2[:user]
|
3614
|
+
assert_equal 'default_password', host2[:password]
|
3615
|
+
assert_equal '/default_path', host2[:path]
|
3616
|
+
end
|
3617
|
+
|
3595
3618
|
def test_hosts_list_with_escape_placeholders
|
3596
3619
|
config = %{
|
3597
3620
|
hosts https://%{j+hn}:%{passw@rd}@host1:443/elastic/,http://host2
|
@@ -3662,6 +3685,31 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3662
3685
|
assert_equal '/default_path', host2[:path]
|
3663
3686
|
end
|
3664
3687
|
|
3688
|
+
def test_hosts_list_with_existing_connection
|
3689
|
+
config = %{
|
3690
|
+
path /default_path
|
3691
|
+
user default_user
|
3692
|
+
password default_password
|
3693
|
+
}
|
3694
|
+
instance = driver(config).instance
|
3695
|
+
|
3696
|
+
assert_equal 2, instance.get_connection_options("https://john:password@[2404:7a80:d440:3000:192a:a292:bd7f:ca19]:443/elastic/,http://host2")[:hosts].length
|
3697
|
+
host1, host2 = instance.get_connection_options("https://john:password@[2404:7a80:d440:3000:192a:a292:bd7f:ca19]:443/elastic/,http://host2")[:hosts]
|
3698
|
+
|
3699
|
+
assert_equal '[2404:7a80:d440:3000:192a:a292:bd7f:ca19]', host1[:host]
|
3700
|
+
assert_equal 443, host1[:port]
|
3701
|
+
assert_equal 'https', host1[:scheme]
|
3702
|
+
assert_equal 'john', host1[:user]
|
3703
|
+
assert_equal 'password', host1[:password]
|
3704
|
+
assert_equal '/elastic/', host1[:path]
|
3705
|
+
|
3706
|
+
assert_equal 'host2', host2[:host]
|
3707
|
+
assert_equal 'http', host2[:scheme]
|
3708
|
+
assert_equal 'default_user', host2[:user]
|
3709
|
+
assert_equal 'default_password', host2[:password]
|
3710
|
+
assert_equal '/default_path', host2[:path]
|
3711
|
+
end
|
3712
|
+
|
3665
3713
|
def test_hosts_list_with_escape_placeholders
|
3666
3714
|
config = %{
|
3667
3715
|
hosts https://%{j+hn}:%{passw@rd}@[2404:7a80:d440:3000:192a:a292:bd7f:ca19]:443/elastic/,http://host2
|
@@ -3708,6 +3756,24 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3708
3756
|
assert_equal nil, host1[:path]
|
3709
3757
|
end
|
3710
3758
|
|
3759
|
+
def test_single_existing_connection
|
3760
|
+
config = %{
|
3761
|
+
user john
|
3762
|
+
password doe
|
3763
|
+
}
|
3764
|
+
instance = driver(config).instance
|
3765
|
+
|
3766
|
+
assert_equal 1, instance.get_connection_options("logs.google.com")[:hosts].length
|
3767
|
+
host1 = instance.get_connection_options("logs.google.com")[:hosts][0]
|
3768
|
+
|
3769
|
+
assert_equal 'logs.google.com', host1[:host]
|
3770
|
+
assert_equal 9200, host1[:port]
|
3771
|
+
assert_equal 'http', host1[:scheme]
|
3772
|
+
assert_equal 'john', host1[:user]
|
3773
|
+
assert_equal 'doe', host1[:password]
|
3774
|
+
assert_equal nil, host1[:path]
|
3775
|
+
end
|
3776
|
+
|
3711
3777
|
def test_single_host_params_and_defaults_with_escape_placeholders
|
3712
3778
|
config = %{
|
3713
3779
|
host logs.google.com
|
@@ -3762,6 +3828,34 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3762
3828
|
assert_equal nil, host1[:path]
|
3763
3829
|
end
|
3764
3830
|
|
3831
|
+
def test_single_existing_connection
|
3832
|
+
config = %{
|
3833
|
+
user john
|
3834
|
+
password doe
|
3835
|
+
}
|
3836
|
+
instance = driver(config).instance
|
3837
|
+
|
3838
|
+
assert_equal 1, instance.get_connection_options("2404:7a80:d440:3000:192a:a292:bd7f:ca19")[:hosts].length
|
3839
|
+
host1 = instance.get_connection_options("2404:7a80:d440:3000:192a:a292:bd7f:ca19")[:hosts][0]
|
3840
|
+
|
3841
|
+
assert_equal 1, instance.get_connection_options("[2404:7a80:d440:3000:192a:a292:bd7f:ca19]")[:hosts].length
|
3842
|
+
host2 = instance.get_connection_options("[2404:7a80:d440:3000:192a:a292:bd7f:ca19]")[:hosts][0]
|
3843
|
+
|
3844
|
+
assert_equal '[2404:7a80:d440:3000:192a:a292:bd7f:ca19]', host1[:host]
|
3845
|
+
assert_equal 9200, host1[:port]
|
3846
|
+
assert_equal 'http', host1[:scheme]
|
3847
|
+
assert_equal 'john', host1[:user]
|
3848
|
+
assert_equal 'doe', host1[:password]
|
3849
|
+
assert_equal nil, host1[:path]
|
3850
|
+
|
3851
|
+
assert_equal '[2404:7a80:d440:3000:192a:a292:bd7f:ca19]', host2[:host]
|
3852
|
+
assert_equal 9200, host2[:port]
|
3853
|
+
assert_equal 'http', host2[:scheme]
|
3854
|
+
assert_equal 'john', host2[:user]
|
3855
|
+
assert_equal 'doe', host2[:password]
|
3856
|
+
assert_equal nil, host2[:path]
|
3857
|
+
end
|
3858
|
+
|
3765
3859
|
def test_single_host_params_and_defaults_with_escape_placeholders
|
3766
3860
|
config = %{
|
3767
3861
|
host 2404:7a80:d440:3000:192a:a292:bd7f:ca19
|
@@ -3794,13 +3888,15 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3794
3888
|
|
3795
3889
|
def test_content_type_header
|
3796
3890
|
stub_request(:head, "http://localhost:9200/").
|
3797
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3891
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3798
3892
|
if Elasticsearch::VERSION >= "6.0.2"
|
3799
3893
|
elastic_request = stub_request(:post, "http://localhost:9200/_bulk").
|
3800
|
-
with(headers: { "Content-Type" => "application/x-ndjson" })
|
3894
|
+
with(headers: { "Content-Type" => "application/x-ndjson" }).
|
3895
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3801
3896
|
else
|
3802
3897
|
elastic_request = stub_request(:post, "http://localhost:9200/_bulk").
|
3803
|
-
with(headers: { "Content-Type" => "application/json" })
|
3898
|
+
with(headers: { "Content-Type" => "application/json" }).
|
3899
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3804
3900
|
end
|
3805
3901
|
stub_elastic_info
|
3806
3902
|
driver.run(default_tag: 'test') do
|
@@ -3811,9 +3907,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3811
3907
|
|
3812
3908
|
def test_custom_headers
|
3813
3909
|
stub_request(:head, "http://localhost:9200/").
|
3814
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3910
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3815
3911
|
elastic_request = stub_request(:post, "http://localhost:9200/_bulk").
|
3816
|
-
with(headers: {'custom' => 'header1','and_others' => 'header2' })
|
3912
|
+
with(headers: {'custom' => 'header1','and_others' => 'header2' }).
|
3913
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3817
3914
|
stub_elastic_info
|
3818
3915
|
driver.configure(%[custom_headers {"custom":"header1", "and_others":"header2"}])
|
3819
3916
|
driver.run(default_tag: 'test') do
|
@@ -3824,9 +3921,10 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3824
3921
|
|
3825
3922
|
def test_api_key_header
|
3826
3923
|
stub_request(:head, "http://localhost:9200/").
|
3827
|
-
to_return(:status => 200, :body => "", :headers => {})
|
3924
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3828
3925
|
elastic_request = stub_request(:post, "http://localhost:9200/_bulk").
|
3829
|
-
with(headers: {'Authorization'=>'ApiKey dGVzdGF1dGhoZWFkZXI='})
|
3926
|
+
with(headers: {'Authorization'=>'ApiKey dGVzdGF1dGhoZWFkZXI='}).
|
3927
|
+
to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
3830
3928
|
stub_elastic_info
|
3831
3929
|
driver.configure(%[api_key testauthheader])
|
3832
3930
|
driver.run(default_tag: 'test') do
|
@@ -3895,7 +3993,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3895
3993
|
compressed_body = gzip(bodystr, Zlib::DEFAULT_COMPRESSION)
|
3896
3994
|
|
3897
3995
|
elastic_request = stub_request(:post, "http://localhost:9200/_bulk").
|
3898
|
-
to_return(:status => 200, :headers => {'Content-Type' => 'Application/json'}, :body => compressed_body)
|
3996
|
+
to_return(:status => 200, :headers => {'Content-Type' => 'Application/json', 'x-elastic-product' => 'Elasticsearch'}, :body => compressed_body)
|
3899
3997
|
stub_elastic_info("http://localhost:9200/")
|
3900
3998
|
|
3901
3999
|
driver(config)
|
@@ -3975,7 +4073,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
3975
4073
|
with(
|
3976
4074
|
body: /#{index_part}\n{"age":26,"request_id":"42","parent_id":"parent","routing_id":"routing","#{chunk_id_key}":".*"}\n/) do |req|
|
3977
4075
|
@index_cmds = req.body.split("\n").map {|r| JSON.parse(r) }
|
3978
|
-
end
|
4076
|
+
end.to_return({:status => 200, :body => "", :headers => { 'Content-Type' => 'json', 'x-elastic-product' => 'Elasticsearch' } })
|
3979
4077
|
stub_elastic_info
|
3980
4078
|
driver.run(default_tag: 'test', shutdown: false) do
|
3981
4079
|
driver.feed(sample_record)
|
@@ -4137,7 +4235,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
4137
4235
|
)
|
4138
4236
|
.to_return(lambda do |req|
|
4139
4237
|
{ :status => 200,
|
4140
|
-
:headers => { 'Content-Type' => 'json' },
|
4238
|
+
:headers => { 'Content-Type' => 'json', 'x-elastic-product' => 'Elasticsearch'},
|
4141
4239
|
:body => return_body_str
|
4142
4240
|
}
|
4143
4241
|
end)
|
@@ -5493,7 +5591,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
5493
5591
|
stub_request(:post, "http://localhost:9200/_bulk").with do |req|
|
5494
5592
|
connection_resets += 1
|
5495
5593
|
raise Faraday::ConnectionFailed, "Test message"
|
5496
|
-
end
|
5594
|
+
end.to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
5497
5595
|
stub_elastic_info
|
5498
5596
|
|
5499
5597
|
assert_raise(Fluent::Plugin::ElasticsearchOutput::RecoverableRequestFailure) {
|
@@ -5510,7 +5608,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
5510
5608
|
stub_request(:post, "http://localhost:9200/_bulk").with do |req|
|
5511
5609
|
connection_resets += 1
|
5512
5610
|
raise ZeroDivisionError, "any not host_unreachable_exceptions exception"
|
5513
|
-
end
|
5611
|
+
end.to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
5514
5612
|
stub_elastic_info
|
5515
5613
|
|
5516
5614
|
driver.configure("reconnect_on_error true\n")
|
@@ -5537,7 +5635,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
5537
5635
|
stub_request(:post, "http://localhost:9200/_bulk").with do |req|
|
5538
5636
|
connection_resets += 1
|
5539
5637
|
raise ZeroDivisionError, "any not host_unreachable_exceptions exception"
|
5540
|
-
end
|
5638
|
+
end.to_return(:status => 200, :body => "", :headers => {'x-elastic-product' => 'Elasticsearch'})
|
5541
5639
|
stub_elastic_info
|
5542
5640
|
|
5543
5641
|
driver.configure("reconnect_on_error false\n")
|
@@ -5561,7 +5659,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
5561
5659
|
stub_request(:post, 'http://localhost:9200/_bulk')
|
5562
5660
|
.to_return(lambda do |req|
|
5563
5661
|
{ :status => 200,
|
5564
|
-
:headers => { 'Content-Type' => 'json' },
|
5662
|
+
:headers => { 'Content-Type' => 'json', 'x-elastic-product' => 'Elasticsearch'},
|
5565
5663
|
:body => %({
|
5566
5664
|
"took" : 1,
|
5567
5665
|
"errors" : true,
|
@@ -5621,7 +5719,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
5621
5719
|
stub_request(:post, 'http://localhost:9200/_bulk')
|
5622
5720
|
.to_return(lambda do |req|
|
5623
5721
|
{ :status => 200,
|
5624
|
-
:headers => { 'Content-Type' => 'json' },
|
5722
|
+
:headers => { 'Content-Type' => 'json', 'x-elastic-product' => 'Elasticsearch'},
|
5625
5723
|
:body => %({
|
5626
5724
|
"took" : 1,
|
5627
5725
|
"errors" : true,
|
@@ -5673,7 +5771,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
5673
5771
|
stub_request(:post, 'http://localhost:9200/_bulk')
|
5674
5772
|
.to_return(lambda do |req|
|
5675
5773
|
{ :status => 200,
|
5676
|
-
:headers => { 'Content-Type' => 'json' },
|
5774
|
+
:headers => { 'Content-Type' => 'json', 'x-elastic-product' => 'Elasticsearch' },
|
5677
5775
|
:body => %({
|
5678
5776
|
"took" : 1,
|
5679
5777
|
"errors" : true,
|
@@ -5724,7 +5822,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
5724
5822
|
stub_request(:post, 'http://localhost:9200/_bulk')
|
5725
5823
|
.to_return(lambda do |req|
|
5726
5824
|
{ :status => 200,
|
5727
|
-
:headers => { 'Content-Type' => 'json' },
|
5825
|
+
:headers => { 'Content-Type' => 'json', 'x-elastic-product' => 'Elasticsearch' },
|
5728
5826
|
:body => %({
|
5729
5827
|
"took" : 1,
|
5730
5828
|
"errors" : true,
|
@@ -5774,7 +5872,7 @@ class ElasticsearchOutputTest < Test::Unit::TestCase
|
|
5774
5872
|
stub_request(:post, 'http://localhost:9200/_bulk')
|
5775
5873
|
.to_return(lambda do |req|
|
5776
5874
|
{ :status => 200,
|
5777
|
-
:headers => { 'Content-Type' => 'json' },
|
5875
|
+
:headers => { 'Content-Type' => 'json', 'x-elastic-product' => 'Elasticsearch'},
|
5778
5876
|
:body => %({
|
5779
5877
|
"took" : 1,
|
5780
5878
|
"errors" : true,
|