logstash-filter-elasticsearch 3.19.0 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -11
- data/docs/index.asciidoc +23 -240
- data/lib/logstash/filters/elasticsearch/client.rb +2 -27
- data/lib/logstash/filters/elasticsearch.rb +124 -177
- data/logstash-filter-elasticsearch.gemspec +3 -6
- data/spec/filters/elasticsearch_spec.rb +272 -163
- data/spec/filters/elasticsearch_ssl_spec.rb +17 -0
- data/spec/filters/integration/elasticsearch_spec.rb +2 -9
- metadata +3 -59
- data/lib/logstash/filters/elasticsearch/dsl_executor.rb +0 -140
- data/lib/logstash/filters/elasticsearch/esql_executor.rb +0 -178
- data/spec/filters/elasticsearch_dsl_spec.rb +0 -372
- data/spec/filters/elasticsearch_esql_spec.rb +0 -211
- data/spec/filters/integration/elasticsearch_esql_spec.rb +0 -167
@@ -60,18 +60,9 @@ describe LogStash::Filters::Elasticsearch do
|
|
60
60
|
allow(plugin).to receive(:get_client).and_return(filter_client)
|
61
61
|
allow(filter_client).to receive(:serverless?).and_return(true)
|
62
62
|
allow(filter_client).to receive(:client).and_return(es_client)
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
.with(a_hash_including(
|
67
|
-
:headers => LogStash::Filters::ElasticsearchClient::DEFAULT_EAV_HEADER))
|
68
|
-
.and_raise(Elastic::Transport::Transport::Errors::BadRequest.new)
|
69
|
-
else
|
70
|
-
allow(es_client).to receive(:info)
|
71
|
-
.with(a_hash_including(
|
72
|
-
:headers => LogStash::Filters::ElasticsearchClient::DEFAULT_EAV_HEADER))
|
73
|
-
.and_raise(Elasticsearch::Transport::Transport::Errors::BadRequest.new)
|
74
|
-
end
|
63
|
+
allow(es_client).to receive(:info).with(a_hash_including(:headers => LogStash::Filters::ElasticsearchClient::DEFAULT_EAV_HEADER)).and_raise(
|
64
|
+
Elasticsearch::Transport::Transport::Errors::BadRequest.new
|
65
|
+
)
|
75
66
|
end
|
76
67
|
|
77
68
|
it "raises an exception when Elastic Api Version is not supported" do
|
@@ -93,6 +84,272 @@ describe LogStash::Filters::Elasticsearch do
|
|
93
84
|
end
|
94
85
|
end
|
95
86
|
|
87
|
+
describe "data fetch" do
|
88
|
+
let(:config) do
|
89
|
+
{
|
90
|
+
"hosts" => ["localhost:9200"],
|
91
|
+
"query" => "response: 404",
|
92
|
+
"fields" => { "response" => "code" },
|
93
|
+
"docinfo_fields" => { "_index" => "es_index" },
|
94
|
+
"aggregation_fields" => { "bytes_avg" => "bytes_avg_ls_field" }
|
95
|
+
}
|
96
|
+
end
|
97
|
+
|
98
|
+
let(:response) do
|
99
|
+
LogStash::Json.load(File.read(File.join(File.dirname(__FILE__), "fixtures", "request_x_1.json")))
|
100
|
+
end
|
101
|
+
|
102
|
+
let(:client) { double(:client) }
|
103
|
+
|
104
|
+
before(:each) do
|
105
|
+
allow(LogStash::Filters::ElasticsearchClient).to receive(:new).and_return(client)
|
106
|
+
allow(client).to receive(:search).and_return(response)
|
107
|
+
allow(plugin).to receive(:test_connection!)
|
108
|
+
allow(plugin).to receive(:setup_serverless)
|
109
|
+
plugin.register
|
110
|
+
end
|
111
|
+
|
112
|
+
after(:each) do
|
113
|
+
Thread.current[:filter_elasticsearch_client] = nil
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should enhance the current event with new data" do
|
117
|
+
plugin.filter(event)
|
118
|
+
expect(event.get("code")).to eq(404)
|
119
|
+
expect(event.get("es_index")).to eq("logstash-2014.08.26")
|
120
|
+
expect(event.get("bytes_avg_ls_field")["value"]).to eq(294)
|
121
|
+
end
|
122
|
+
|
123
|
+
it "should receive all necessary params to perform the search" do
|
124
|
+
expect(client).to receive(:search).with({:q=>"response: 404", :size=>1, :index=>"", :sort=>"@timestamp:desc"})
|
125
|
+
plugin.filter(event)
|
126
|
+
end
|
127
|
+
|
128
|
+
context "when asking to hit specific index" do
|
129
|
+
|
130
|
+
let(:config) do
|
131
|
+
{
|
132
|
+
"index" => "foo*",
|
133
|
+
"hosts" => ["localhost:9200"],
|
134
|
+
"query" => "response: 404",
|
135
|
+
"fields" => { "response" => "code" }
|
136
|
+
}
|
137
|
+
end
|
138
|
+
|
139
|
+
it "should receive all necessary params to perform the search" do
|
140
|
+
expect(client).to receive(:search).with({:q=>"response: 404", :size=>1, :index=>"foo*", :sort=>"@timestamp:desc"})
|
141
|
+
plugin.filter(event)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
context "when asking for more than one result" do
|
146
|
+
|
147
|
+
let(:config) do
|
148
|
+
{
|
149
|
+
"hosts" => ["localhost:9200"],
|
150
|
+
"query" => "response: 404",
|
151
|
+
"fields" => { "response" => "code" },
|
152
|
+
"result_size" => 10
|
153
|
+
}
|
154
|
+
end
|
155
|
+
|
156
|
+
let(:response) do
|
157
|
+
LogStash::Json.load(File.read(File.join(File.dirname(__FILE__), "fixtures", "request_x_10.json")))
|
158
|
+
end
|
159
|
+
|
160
|
+
it "should enhance the current event with new data" do
|
161
|
+
plugin.filter(event)
|
162
|
+
expect(event.get("code")).to eq([404]*10)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
|
166
|
+
context 'when Elasticsearch 7.x gives us a totals object instead of an integer' do
|
167
|
+
let(:config) do
|
168
|
+
{
|
169
|
+
"hosts" => ["localhost:9200"],
|
170
|
+
"query" => "response: 404",
|
171
|
+
"fields" => { "response" => "code" },
|
172
|
+
"result_size" => 10
|
173
|
+
}
|
174
|
+
end
|
175
|
+
|
176
|
+
let(:response) do
|
177
|
+
LogStash::Json.load(File.read(File.join(File.dirname(__FILE__), "fixtures", "elasticsearch_7.x_hits_total_as_object.json")))
|
178
|
+
end
|
179
|
+
|
180
|
+
it "should enhance the current event with new data" do
|
181
|
+
plugin.filter(event)
|
182
|
+
expect(event.get("[@metadata][total_hits]")).to eq(13476)
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
context "if something wrong happen during connection" do
|
187
|
+
|
188
|
+
before(:each) do
|
189
|
+
allow(LogStash::Filters::ElasticsearchClient).to receive(:new).and_return(client)
|
190
|
+
allow(client).to receive(:search).and_raise("connection exception")
|
191
|
+
plugin.register
|
192
|
+
end
|
193
|
+
|
194
|
+
it "tag the event as something happened, but still deliver it" do
|
195
|
+
expect(plugin.logger).to receive(:warn)
|
196
|
+
plugin.filter(event)
|
197
|
+
expect(event.to_hash["tags"]).to include("_elasticsearch_lookup_failure")
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
# Tagging test for positive results
|
202
|
+
context "Tagging should occur if query returns results" do
|
203
|
+
let(:config) do
|
204
|
+
{
|
205
|
+
"index" => "foo*",
|
206
|
+
"hosts" => ["localhost:9200"],
|
207
|
+
"query" => "response: 404",
|
208
|
+
"add_tag" => ["tagged"]
|
209
|
+
}
|
210
|
+
end
|
211
|
+
|
212
|
+
let(:response) do
|
213
|
+
LogStash::Json.load(File.read(File.join(File.dirname(__FILE__), "fixtures", "request_x_10.json")))
|
214
|
+
end
|
215
|
+
|
216
|
+
it "should tag the current event if results returned" do
|
217
|
+
plugin.filter(event)
|
218
|
+
expect(event.to_hash["tags"]).to include("tagged")
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
context "an aggregation search with size 0 that matches" do
|
223
|
+
let(:config) do
|
224
|
+
{
|
225
|
+
"index" => "foo*",
|
226
|
+
"hosts" => ["localhost:9200"],
|
227
|
+
"query" => "response: 404",
|
228
|
+
"add_tag" => ["tagged"],
|
229
|
+
"result_size" => 0,
|
230
|
+
"aggregation_fields" => { "bytes_avg" => "bytes_avg_ls_field" }
|
231
|
+
}
|
232
|
+
end
|
233
|
+
|
234
|
+
let(:response) do
|
235
|
+
LogStash::Json.load(File.read(File.join(File.dirname(__FILE__), "fixtures", "request_size0_agg.json")))
|
236
|
+
end
|
237
|
+
|
238
|
+
it "should tag the current event" do
|
239
|
+
plugin.filter(event)
|
240
|
+
expect(event.get("tags")).to include("tagged")
|
241
|
+
expect(event.get("bytes_avg_ls_field")["value"]).to eq(294)
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
# Tagging test for negative results
|
246
|
+
context "Tagging should not occur if query has no results" do
|
247
|
+
let(:config) do
|
248
|
+
{
|
249
|
+
"index" => "foo*",
|
250
|
+
"hosts" => ["localhost:9200"],
|
251
|
+
"query" => "response: 404",
|
252
|
+
"add_tag" => ["tagged"]
|
253
|
+
}
|
254
|
+
end
|
255
|
+
|
256
|
+
let(:response) do
|
257
|
+
LogStash::Json.load(File.read(File.join(File.dirname(__FILE__), "fixtures", "request_error.json")))
|
258
|
+
end
|
259
|
+
|
260
|
+
it "should not tag the current event" do
|
261
|
+
plugin.filter(event)
|
262
|
+
expect(event.to_hash["tags"]).to_not include("tagged")
|
263
|
+
end
|
264
|
+
end
|
265
|
+
context "testing a simple query template" do
|
266
|
+
let(:config) do
|
267
|
+
{
|
268
|
+
"hosts" => ["localhost:9200"],
|
269
|
+
"query_template" => File.join(File.dirname(__FILE__), "fixtures", "query_template.json"),
|
270
|
+
"fields" => { "response" => "code" },
|
271
|
+
"result_size" => 1
|
272
|
+
}
|
273
|
+
end
|
274
|
+
|
275
|
+
let(:response) do
|
276
|
+
LogStash::Json.load(File.read(File.join(File.dirname(__FILE__), "fixtures", "request_x_1.json")))
|
277
|
+
end
|
278
|
+
|
279
|
+
it "should enhance the current event with new data" do
|
280
|
+
plugin.filter(event)
|
281
|
+
expect(event.get("code")).to eq(404)
|
282
|
+
end
|
283
|
+
|
284
|
+
end
|
285
|
+
|
286
|
+
context "testing a simple index substitution" do
|
287
|
+
let(:event) {
|
288
|
+
LogStash::Event.new(
|
289
|
+
{
|
290
|
+
"subst_field" => "subst_value"
|
291
|
+
}
|
292
|
+
)
|
293
|
+
}
|
294
|
+
let(:config) do
|
295
|
+
{
|
296
|
+
"index" => "foo_%{subst_field}*",
|
297
|
+
"hosts" => ["localhost:9200"],
|
298
|
+
"query" => "response: 404",
|
299
|
+
"fields" => { "response" => "code" }
|
300
|
+
}
|
301
|
+
end
|
302
|
+
|
303
|
+
it "should receive substituted index name" do
|
304
|
+
expect(client).to receive(:search).with({:q => "response: 404", :size => 1, :index => "foo_subst_value*", :sort => "@timestamp:desc"})
|
305
|
+
plugin.filter(event)
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
context "if query result errored but no exception is thrown" do
|
310
|
+
let(:response) do
|
311
|
+
LogStash::Json.load(File.read(File.join(File.dirname(__FILE__), "fixtures", "request_error.json")))
|
312
|
+
end
|
313
|
+
|
314
|
+
before(:each) do
|
315
|
+
allow(LogStash::Filters::ElasticsearchClient).to receive(:new).and_return(client)
|
316
|
+
allow(client).to receive(:search).and_return(response)
|
317
|
+
plugin.register
|
318
|
+
end
|
319
|
+
|
320
|
+
it "tag the event as something happened, but still deliver it" do
|
321
|
+
expect(plugin.logger).to receive(:warn)
|
322
|
+
plugin.filter(event)
|
323
|
+
expect(event.to_hash["tags"]).to include("_elasticsearch_lookup_failure")
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
context 'with client-level retries' do
|
328
|
+
let(:config) do
|
329
|
+
super().merge(
|
330
|
+
"retry_on_failure" => 3,
|
331
|
+
"retry_on_status" => [500]
|
332
|
+
)
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
context "if query is on nested field" do
|
337
|
+
let(:config) do
|
338
|
+
{
|
339
|
+
"hosts" => ["localhost:9200"],
|
340
|
+
"query" => "response: 404",
|
341
|
+
"fields" => [ ["[geoip][ip]", "ip_address"] ]
|
342
|
+
}
|
343
|
+
end
|
344
|
+
|
345
|
+
it "should enhance the current event with new data" do
|
346
|
+
plugin.filter(event)
|
347
|
+
expect(event.get("ip_address")).to eq("66.249.73.185")
|
348
|
+
end
|
349
|
+
|
350
|
+
end
|
351
|
+
end
|
352
|
+
|
96
353
|
class StoppableServer
|
97
354
|
|
98
355
|
attr_reader :port
|
@@ -225,12 +482,7 @@ describe LogStash::Filters::Elasticsearch do
|
|
225
482
|
# this spec is a safeguard to trigger an assessment of thread-safety should
|
226
483
|
# we choose a different transport adapter in the future.
|
227
484
|
transport_class = extract_transport(client).options.fetch(:transport_class)
|
228
|
-
|
229
|
-
allow(client).to receive(:es_transport_client_type).and_return("elastic_transport")
|
230
|
-
expect(transport_class).to equal ::Elastic::Transport::Transport::HTTP::Manticore
|
231
|
-
else
|
232
|
-
expect(transport_class).to equal ::Elasticsearch::Transport::Transport::HTTP::Manticore
|
233
|
-
end
|
485
|
+
expect(transport_class).to equal ::Elasticsearch::Transport::Transport::HTTP::Manticore
|
234
486
|
end
|
235
487
|
|
236
488
|
it 'uses a client with sufficient connection pool size' do
|
@@ -545,11 +797,6 @@ describe LogStash::Filters::Elasticsearch do
|
|
545
797
|
|
546
798
|
before(:each) do
|
547
799
|
allow(LogStash::Filters::ElasticsearchClient).to receive(:new).and_return(client)
|
548
|
-
if defined?(Elastic::Transport)
|
549
|
-
allow(client).to receive(:es_transport_client_type).and_return('elastic_transport')
|
550
|
-
else
|
551
|
-
allow(client).to receive(:es_transport_client_type).and_return('elasticsearch_transport')
|
552
|
-
end
|
553
800
|
allow(plugin).to receive(:test_connection!)
|
554
801
|
allow(plugin).to receive(:setup_serverless)
|
555
802
|
plugin.register
|
@@ -564,146 +811,8 @@ describe LogStash::Filters::Elasticsearch do
|
|
564
811
|
end
|
565
812
|
end
|
566
813
|
|
567
|
-
|
568
|
-
|
569
|
-
describe "compatibility" do
|
570
|
-
let(:config) {{ "hosts" => ["localhost:9200"], "query_type" => "esql", "query" => "FROM my-index" }}
|
571
|
-
|
572
|
-
context "when LS doesn't support ES|QL" do
|
573
|
-
let(:ls_version) { LogStash::Filters::Elasticsearch::LS_ESQL_SUPPORT_VERSION }
|
574
|
-
before(:each) do
|
575
|
-
stub_const("LOGSTASH_VERSION", "8.17.0")
|
576
|
-
end
|
577
|
-
|
578
|
-
it "raises a runtime error" do
|
579
|
-
expect { plugin.send(:validate_ls_version_for_esql_support!) }
|
580
|
-
.to raise_error(RuntimeError, /Current version of Logstash does not include Elasticsearch client which supports ES|QL. Please upgrade Logstash to at least #{ls_version}/)
|
581
|
-
end
|
582
|
-
end
|
583
|
-
|
584
|
-
context "when ES doesn't support ES|QL" do
|
585
|
-
let(:es_version) { LogStash::Filters::Elasticsearch::ES_ESQL_SUPPORT_VERSION }
|
586
|
-
let(:client) { double(:client) }
|
587
|
-
|
588
|
-
it "raises a runtime error" do
|
589
|
-
allow(plugin).to receive(:get_client).twice.and_return(client)
|
590
|
-
allow(client).to receive(:es_version).and_return("8.8.0")
|
591
|
-
|
592
|
-
expect { plugin.send(:validate_es_for_esql_support!) }
|
593
|
-
.to raise_error(RuntimeError, /Connected Elasticsearch 8.8.0 version does not supports ES|QL. ES|QL feature requires at least Elasticsearch #{es_version} version./)
|
594
|
-
end
|
595
|
-
end
|
596
|
-
end
|
597
|
-
|
598
|
-
context "when non-ES|QL params applied" do
|
599
|
-
let(:config) do
|
600
|
-
{
|
601
|
-
"hosts" => ["localhost:9200"],
|
602
|
-
"query_type" => "esql",
|
603
|
-
"query" => "FROM my-index",
|
604
|
-
"index" => "some-index",
|
605
|
-
"docinfo_fields" => { "_index" => "es_index" },
|
606
|
-
"sort" => "@timestamp:desc",
|
607
|
-
"enable_sort" => true,
|
608
|
-
"aggregation_fields" => { "bytes_avg" => "bytes_avg_ls_field" }
|
609
|
-
}
|
610
|
-
end
|
611
|
-
it "raises a config error" do
|
612
|
-
invalid_params_with_esql = %w(index docinfo_fields sort enable_sort aggregation_fields)
|
613
|
-
error_text = /Configured #{invalid_params_with_esql} params cannot be used with ES|QL query/i
|
614
|
-
expect { plugin.register }.to raise_error LogStash::ConfigurationError, error_text
|
615
|
-
end
|
616
|
-
end
|
617
|
-
|
618
|
-
describe "#query placeholder" do
|
619
|
-
let(:config) do
|
620
|
-
{
|
621
|
-
"hosts" => ["localhost:9200"],
|
622
|
-
"query_type" => "esql"
|
623
|
-
}
|
624
|
-
end
|
625
|
-
|
626
|
-
context "when query placeholder doesn't exist in the query" do
|
627
|
-
let(:config) {
|
628
|
-
super()
|
629
|
-
.merge(
|
630
|
-
{
|
631
|
-
"query" => "FROM my-index",
|
632
|
-
"query_params" => { "a" => "b" },
|
633
|
-
})
|
634
|
-
}
|
635
|
-
|
636
|
-
it "doesn't complain since not used" do
|
637
|
-
expect { plugin.send(:validate_esql_query_and_params!) }.not_to raise_error
|
638
|
-
end
|
639
|
-
end
|
640
|
-
|
641
|
-
context "when illegal placeholders appear" do
|
642
|
-
let(:config) {
|
643
|
-
super()
|
644
|
-
.merge(
|
645
|
-
{
|
646
|
-
"query" => "FROM my-index | WHERE type = ?type",
|
647
|
-
"query_params" => { "1abcd_efg1" => "1", "$abcd_efg1" => 2, "type" => 3 },
|
648
|
-
})
|
649
|
-
}
|
650
|
-
it "raises a config error" do
|
651
|
-
message = 'Illegal ["1abcd_efg1", "$abcd_efg1"] placeholder names in `query_params`. A valid parameter name starts with a letter and contains letters, digits and underscores only;'
|
652
|
-
expect { plugin.register }.to raise_error LogStash::ConfigurationError, message
|
653
|
-
end
|
654
|
-
end
|
655
|
-
|
656
|
-
context "when query placeholders and `query_params` do not match" do
|
657
|
-
let(:config) {
|
658
|
-
super()
|
659
|
-
.merge(
|
660
|
-
{
|
661
|
-
"query" => "FROM my-index | WHERE type = ?type",
|
662
|
-
"query_params" => {"b" => "c"},
|
663
|
-
})
|
664
|
-
}
|
665
|
-
it "raises a config error" do
|
666
|
-
expect { plugin.register }.to raise_error LogStash::ConfigurationError, /Placeholder type not found in query/
|
667
|
-
end
|
668
|
-
end
|
669
|
-
|
670
|
-
context "when `query_params` is an Array contains {key => val} entries" do
|
671
|
-
let(:config) {
|
672
|
-
super()
|
673
|
-
.merge(
|
674
|
-
{
|
675
|
-
"query" => "FROM my-index",
|
676
|
-
"query_params" => [{ "a" => "b" }, { "c" => "[b]" }, { "e" => 1 }, { "f" => "[g]" }],
|
677
|
-
})
|
678
|
-
}
|
679
|
-
|
680
|
-
it "doesn't complain since not used" do
|
681
|
-
expect { plugin.send(:validate_esql_query_and_params!) }.not_to raise_error
|
682
|
-
expect(plugin.query_params).to eq({ "a" => "b", "c" => "[b]", "e" => 1, "f" => "[g]" })
|
683
|
-
end
|
684
|
-
end
|
685
|
-
|
686
|
-
context "when `query_params` is a Hash" do
|
687
|
-
let(:config) {
|
688
|
-
super()
|
689
|
-
.merge(
|
690
|
-
{
|
691
|
-
"query" => "FROM my-index",
|
692
|
-
"query_params" => { "a" => "b", "c" => "[b]", "e" => 1, "f" => "[g]" },
|
693
|
-
})
|
694
|
-
}
|
695
|
-
|
696
|
-
it "doesn't complain since not used" do
|
697
|
-
expect { plugin.send(:validate_esql_query_and_params!) }.not_to raise_error
|
698
|
-
expect(plugin.query_params).to eq({ "a" => "b", "c" => "[b]", "e" => 1, "f" => "[g]" })
|
699
|
-
end
|
700
|
-
end
|
701
|
-
end if LOGSTASH_VERSION >= '8.17.4'
|
702
|
-
end
|
703
|
-
|
704
|
-
def extract_transport(client)
|
705
|
-
# on 7x: client.transport.transport
|
706
|
-
# on >=8.x: client.transport
|
814
|
+
# @note can be removed once gem depends on elasticsearch >= 6.x
|
815
|
+
def extract_transport(client) # on 7.x client.transport is a ES::Transport::Client
|
707
816
|
client.transport.respond_to?(:transport) ? client.transport.transport : client.transport
|
708
817
|
end
|
709
818
|
|
@@ -24,6 +24,23 @@ describe "SSL options" do
|
|
24
24
|
subject.close
|
25
25
|
end
|
26
26
|
|
27
|
+
describe "obsolete settings" do
|
28
|
+
[{:name => 'ca_file', :canonical_name => 'ssl_certificate_authorities'},
|
29
|
+
{:name => "keystore", :canonical_name => 'ssl_keystore_path'},
|
30
|
+
{:name => "keystore_password", :canonical_name => "ssl_keystore_password"},
|
31
|
+
{:name => "ssl", :canonical_name => "ssl_enabled"}
|
32
|
+
].each do |config_settings|
|
33
|
+
context "with option #{config_settings[:name]}" do
|
34
|
+
let(:obsolete_config) { settings.merge(config_settings[:name] => 'test_value') }
|
35
|
+
it "emits an error about the setting `#{config_settings[:name]}` now being obsolete and provides guidance to use `#{config_settings[:canonical_name]}`" do
|
36
|
+
error_text = /The setting `#{config_settings[:name]}` in plugin `elasticsearch` is obsolete and is no longer available. Set '#{config_settings[:canonical_name]}' instead/i
|
37
|
+
expect { LogStash::Filters::Elasticsearch.new(obsolete_config) }.to raise_error LogStash::ConfigurationError, error_text
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
27
44
|
context "when ssl_enabled is" do
|
28
45
|
context "true and there is no https hosts" do
|
29
46
|
let(:hosts) { %w[http://es01 http://es01] }
|
@@ -84,9 +84,7 @@ describe LogStash::Filters::Elasticsearch, :integration => true do
|
|
84
84
|
end
|
85
85
|
|
86
86
|
it "fails to register plugin" do
|
87
|
-
expect { plugin.register }.to raise_error
|
88
|
-
Elastic::Transport::Transport::Errors::Unauthorized :
|
89
|
-
Elasticsearch::Transport::Transport::Errors::Unauthorized
|
87
|
+
expect { plugin.register }.to raise_error Elasticsearch::Transport::Transport::Errors::Unauthorized
|
90
88
|
end
|
91
89
|
|
92
90
|
end if ELASTIC_SECURITY_ENABLED
|
@@ -152,10 +150,5 @@ describe LogStash::Filters::Elasticsearch, :integration => true do
|
|
152
150
|
end
|
153
151
|
end
|
154
152
|
end
|
155
|
-
|
156
|
-
Elasticsearch::Transport
|
157
|
-
false
|
158
|
-
rescue NameError # NameError: uninitialized constant Elasticsearch::Transport if Elastic Ruby client is not available
|
159
|
-
true
|
160
|
-
end
|
153
|
+
|
161
154
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-filter-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-01-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -36,9 +36,6 @@ dependencies:
|
|
36
36
|
- - ">="
|
37
37
|
- !ruby/object:Gem::Version
|
38
38
|
version: 7.14.9
|
39
|
-
- - "<"
|
40
|
-
- !ruby/object:Gem::Version
|
41
|
-
version: '9'
|
42
39
|
name: elasticsearch
|
43
40
|
type: :runtime
|
44
41
|
prerelease: false
|
@@ -47,9 +44,6 @@ dependencies:
|
|
47
44
|
- - ">="
|
48
45
|
- !ruby/object:Gem::Version
|
49
46
|
version: 7.14.9
|
50
|
-
- - "<"
|
51
|
-
- !ruby/object:Gem::Version
|
52
|
-
version: '9'
|
53
47
|
- !ruby/object:Gem::Dependency
|
54
48
|
requirement: !ruby/object:Gem::Requirement
|
55
49
|
requirements:
|
@@ -64,20 +58,6 @@ dependencies:
|
|
64
58
|
- - ">="
|
65
59
|
- !ruby/object:Gem::Version
|
66
60
|
version: 0.7.1
|
67
|
-
- !ruby/object:Gem::Dependency
|
68
|
-
requirement: !ruby/object:Gem::Requirement
|
69
|
-
requirements:
|
70
|
-
- - "~>"
|
71
|
-
- !ruby/object:Gem::Version
|
72
|
-
version: '1.3'
|
73
|
-
name: logstash-mixin-ecs_compatibility_support
|
74
|
-
type: :runtime
|
75
|
-
prerelease: false
|
76
|
-
version_requirements: !ruby/object:Gem::Requirement
|
77
|
-
requirements:
|
78
|
-
- - "~>"
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
version: '1.3'
|
81
61
|
- !ruby/object:Gem::Dependency
|
82
62
|
requirement: !ruby/object:Gem::Requirement
|
83
63
|
requirements:
|
@@ -92,34 +72,6 @@ dependencies:
|
|
92
72
|
- - "~>"
|
93
73
|
- !ruby/object:Gem::Version
|
94
74
|
version: '1.0'
|
95
|
-
- !ruby/object:Gem::Dependency
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
97
|
-
requirements:
|
98
|
-
- - "~>"
|
99
|
-
- !ruby/object:Gem::Version
|
100
|
-
version: '1.0'
|
101
|
-
name: logstash-mixin-normalize_config_support
|
102
|
-
type: :runtime
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
requirements:
|
106
|
-
- - "~>"
|
107
|
-
- !ruby/object:Gem::Version
|
108
|
-
version: '1.0'
|
109
|
-
- !ruby/object:Gem::Dependency
|
110
|
-
requirement: !ruby/object:Gem::Requirement
|
111
|
-
requirements:
|
112
|
-
- - "~>"
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
version: '1.0'
|
115
|
-
name: logstash-mixin-validator_support
|
116
|
-
type: :runtime
|
117
|
-
prerelease: false
|
118
|
-
version_requirements: !ruby/object:Gem::Requirement
|
119
|
-
requirements:
|
120
|
-
- - "~>"
|
121
|
-
- !ruby/object:Gem::Version
|
122
|
-
version: '1.0'
|
123
75
|
- !ruby/object:Gem::Dependency
|
124
76
|
requirement: !ruby/object:Gem::Requirement
|
125
77
|
requirements:
|
@@ -179,13 +131,9 @@ files:
|
|
179
131
|
- docs/index.asciidoc
|
180
132
|
- lib/logstash/filters/elasticsearch.rb
|
181
133
|
- lib/logstash/filters/elasticsearch/client.rb
|
182
|
-
- lib/logstash/filters/elasticsearch/dsl_executor.rb
|
183
|
-
- lib/logstash/filters/elasticsearch/esql_executor.rb
|
184
134
|
- lib/logstash/filters/elasticsearch/patches/_elasticsearch_transport_http_manticore.rb
|
185
135
|
- logstash-filter-elasticsearch.gemspec
|
186
136
|
- spec/es_helper.rb
|
187
|
-
- spec/filters/elasticsearch_dsl_spec.rb
|
188
|
-
- spec/filters/elasticsearch_esql_spec.rb
|
189
137
|
- spec/filters/elasticsearch_spec.rb
|
190
138
|
- spec/filters/elasticsearch_ssl_spec.rb
|
191
139
|
- spec/filters/fixtures/elasticsearch_7.x_hits_total_as_object.json
|
@@ -211,9 +159,8 @@ files:
|
|
211
159
|
- spec/filters/fixtures/test_certs/ls.crt
|
212
160
|
- spec/filters/fixtures/test_certs/ls.der.sha256
|
213
161
|
- spec/filters/fixtures/test_certs/ls.key
|
214
|
-
- spec/filters/integration/elasticsearch_esql_spec.rb
|
215
162
|
- spec/filters/integration/elasticsearch_spec.rb
|
216
|
-
homepage:
|
163
|
+
homepage: http://www.elastic.co/guide/en/logstash/current/index.html
|
217
164
|
licenses:
|
218
165
|
- Apache License (2.0)
|
219
166
|
metadata:
|
@@ -240,8 +187,6 @@ specification_version: 4
|
|
240
187
|
summary: Copies fields from previous log events in Elasticsearch to current events
|
241
188
|
test_files:
|
242
189
|
- spec/es_helper.rb
|
243
|
-
- spec/filters/elasticsearch_dsl_spec.rb
|
244
|
-
- spec/filters/elasticsearch_esql_spec.rb
|
245
190
|
- spec/filters/elasticsearch_spec.rb
|
246
191
|
- spec/filters/elasticsearch_ssl_spec.rb
|
247
192
|
- spec/filters/fixtures/elasticsearch_7.x_hits_total_as_object.json
|
@@ -267,5 +212,4 @@ test_files:
|
|
267
212
|
- spec/filters/fixtures/test_certs/ls.crt
|
268
213
|
- spec/filters/fixtures/test_certs/ls.der.sha256
|
269
214
|
- spec/filters/fixtures/test_certs/ls.key
|
270
|
-
- spec/filters/integration/elasticsearch_esql_spec.rb
|
271
215
|
- spec/filters/integration/elasticsearch_spec.rb
|