logstash-input-elasticsearch 4.12.3 → 4.13.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 +4 -2
- data/docs/index.asciidoc +10 -0
- data/lib/logstash/inputs/elasticsearch.rb +11 -1
- data/logstash-input-elasticsearch.gemspec +5 -1
- data/spec/fixtures/test_certs/ca.der.sha256 +1 -0
- data/spec/inputs/elasticsearch_spec.rb +89 -143
- data/spec/inputs/integration/elasticsearch_spec.rb +29 -9
- metadata +32 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d87078bdf63844901c7684624bc15bd6af23c71c728adb20b86ba76738957926
|
4
|
+
data.tar.gz: 34d8ce81035665b93623aec9008c511000b80a463c0cf482fb459249c763aeaf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b2c5aa7a229bdbc89df35276c22a72f1cdbefc03a9069dfb74e64aad64d121aeb3ee67a9b632fd8ab445d1a256cce23f67feabb4ff379ed78a15507f28b1dce
|
7
|
+
data.tar.gz: 7c7a45cd3817d9e746a03eb166293e389eee16fc512bb2e0ecc546158d67f1f4e0f54bc191212e02ce1af206fe5f98374d70defa3f8ef218bed9e210ac8a8a65
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
+
## 4.13.0
|
2
|
+
- Added support for `ca_trusted_fingerprint` when run on Logstash 8.3+ [#178](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/178)
|
3
|
+
|
1
4
|
## 4.12.3
|
2
|
-
- Fix: update Elasticsearch Ruby client to correctly customize 'user-agent' header[#171](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/171)
|
5
|
+
- Fix: update Elasticsearch Ruby client to correctly customize 'user-agent' header [#171](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/171)
|
3
6
|
|
4
7
|
## 4.12.2
|
5
8
|
- Fix: hosts => "es_host:port" regression [#168](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/168)
|
@@ -24,7 +27,6 @@
|
|
24
27
|
header isn't passed, this leads to the plugin not being able to leverage `user`/`password` credentials set by the user.
|
25
28
|
[#153](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/153)
|
26
29
|
|
27
|
-
|
28
30
|
## 4.9.1
|
29
31
|
- [DOC] Replaced hard-coded links with shared attributes [#143](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/143)
|
30
32
|
- [DOC] Added missing quote to docinfo_fields example [#145](https://github.com/logstash-plugins/logstash-input-elasticsearch/pull/145)
|
data/docs/index.asciidoc
CHANGED
@@ -103,6 +103,7 @@ This plugin supports the following configuration options plus the <<plugins-{typ
|
|
103
103
|
|Setting |Input type|Required
|
104
104
|
| <<plugins-{type}s-{plugin}-api_key>> |<<password,password>>|No
|
105
105
|
| <<plugins-{type}s-{plugin}-ca_file>> |a valid filesystem path|No
|
106
|
+
| <<plugins-{type}s-{plugin}-ca_trusted_fingerprint>> |<<string,string>>|No
|
106
107
|
| <<plugins-{type}s-{plugin}-cloud_auth>> |<<password,password>>|No
|
107
108
|
| <<plugins-{type}s-{plugin}-cloud_id>> |<<string,string>>|No
|
108
109
|
| <<plugins-{type}s-{plugin}-connect_timeout_seconds>> | <<number,number>>|No
|
@@ -152,6 +153,15 @@ API key API].
|
|
152
153
|
|
153
154
|
SSL Certificate Authority file in PEM encoded format, must also include any chain certificates as necessary.
|
154
155
|
|
156
|
+
[id="plugins-{type}s-{plugin}-ca_trusted_fingerprint"]
|
157
|
+
===== `ca_trusted_fingerprint`
|
158
|
+
|
159
|
+
* Value type is <<string,string>>, and must contain exactly 64 hexadecimal characters.
|
160
|
+
* There is no default value for this setting.
|
161
|
+
* Use of this option _requires_ Logstash 8.3+
|
162
|
+
|
163
|
+
The SHA-256 fingerprint of an SSL Certificate Authority to trust, such as the autogenerated self-signed CA for an Elasticsearch cluster.
|
164
|
+
|
155
165
|
[id="plugins-{type}s-{plugin}-cloud_auth"]
|
156
166
|
===== `cloud_auth`
|
157
167
|
|
@@ -7,6 +7,7 @@ require 'logstash/plugin_mixins/validator_support/field_reference_validation_ada
|
|
7
7
|
require 'logstash/plugin_mixins/event_support/event_factory_adapter'
|
8
8
|
require 'logstash/plugin_mixins/ecs_compatibility_support'
|
9
9
|
require 'logstash/plugin_mixins/ecs_compatibility_support/target_check'
|
10
|
+
require 'logstash/plugin_mixins/ca_trusted_fingerprint_support'
|
10
11
|
require "base64"
|
11
12
|
|
12
13
|
require "elasticsearch"
|
@@ -192,6 +193,9 @@ class LogStash::Inputs::Elasticsearch < LogStash::Inputs::Base
|
|
192
193
|
# If set, the _source of each hit will be added nested under the target instead of at the top-level
|
193
194
|
config :target, :validate => :field_reference
|
194
195
|
|
196
|
+
# config :ca_trusted_fingerprint, :validate => :sha_256_hex
|
197
|
+
include LogStash::PluginMixins::CATrustedFingerprintSupport
|
198
|
+
|
195
199
|
def initialize(params={})
|
196
200
|
super(params)
|
197
201
|
|
@@ -381,7 +385,13 @@ class LogStash::Inputs::Elasticsearch < LogStash::Inputs::Base
|
|
381
385
|
end
|
382
386
|
|
383
387
|
def setup_ssl
|
384
|
-
|
388
|
+
ssl_options = {}
|
389
|
+
|
390
|
+
ssl_options[:ssl] = true if @ssl
|
391
|
+
ssl_options[:ca_file] = @ca_file if @ssl && @ca_file
|
392
|
+
ssl_options[:trust_strategy] = trust_strategy_for_ca_trusted_fingerprint
|
393
|
+
|
394
|
+
ssl_options
|
385
395
|
end
|
386
396
|
|
387
397
|
def setup_hosts
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = 'logstash-input-elasticsearch'
|
4
|
-
s.version = '4.
|
4
|
+
s.version = '4.13.0'
|
5
5
|
s.licenses = ['Apache License (2.0)']
|
6
6
|
s.summary = "Reads query results from an Elasticsearch cluster"
|
7
7
|
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
|
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
s.add_runtime_dependency "logstash-mixin-validator_support", '~> 1.0'
|
27
27
|
|
28
28
|
s.add_runtime_dependency 'elasticsearch', '>= 7.17.1'
|
29
|
+
s.add_runtime_dependency 'logstash-mixin-ca_trusted_fingerprint_support', '~> 1.0'
|
29
30
|
|
30
31
|
s.add_runtime_dependency 'tzinfo'
|
31
32
|
s.add_runtime_dependency 'tzinfo-data'
|
@@ -37,4 +38,7 @@ Gem::Specification.new do |s|
|
|
37
38
|
s.add_development_dependency 'timecop'
|
38
39
|
s.add_development_dependency 'cabin', ['~> 0.6']
|
39
40
|
s.add_development_dependency 'webrick'
|
41
|
+
|
42
|
+
# 3.8.0 has breaking changes WRT to joining, which break our specs
|
43
|
+
s.add_development_dependency 'rufus-scheduler', '~> 3.0.9'
|
40
44
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
195a7e7b1bc29f3d7913a918a44721704d27fa56facea0cd72a8093c7107c283
|
@@ -19,7 +19,14 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
|
|
19
19
|
let(:queue) { Queue.new }
|
20
20
|
|
21
21
|
before(:each) do
|
22
|
-
|
22
|
+
Elasticsearch::Client.send(:define_method, :ping) { } # define no-action ping method
|
23
|
+
end
|
24
|
+
|
25
|
+
let(:base_config) do
|
26
|
+
{
|
27
|
+
'hosts' => ["localhost"],
|
28
|
+
'query' => '{ "query": { "match": { "city_name": "Okinawa" } }, "fields": ["message"] }'
|
29
|
+
}
|
23
30
|
end
|
24
31
|
|
25
32
|
context "register" do
|
@@ -78,14 +85,10 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
|
|
78
85
|
end
|
79
86
|
|
80
87
|
let(:config) do
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
query => '{ "query": { "match": { "city_name": "Okinawa" } }, "fields": ["message"] }'
|
86
|
-
}
|
87
|
-
}
|
88
|
-
]
|
88
|
+
{
|
89
|
+
'hosts' => ["localhost"],
|
90
|
+
'query' => '{ "query": { "match": { "city_name": "Okinawa" } }, "fields": ["message"] }'
|
91
|
+
}
|
89
92
|
end
|
90
93
|
|
91
94
|
let(:mock_response) do
|
@@ -128,10 +131,11 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
|
|
128
131
|
expect(client).to receive(:ping)
|
129
132
|
end
|
130
133
|
|
134
|
+
before { plugin.register }
|
135
|
+
|
131
136
|
it 'creates the events from the hits' do
|
132
|
-
|
133
|
-
|
134
|
-
end
|
137
|
+
plugin.run queue
|
138
|
+
event = queue.pop
|
135
139
|
|
136
140
|
expect(event).to be_a(LogStash::Event)
|
137
141
|
expect(event.get("message")).to eql [ "ohayo" ]
|
@@ -139,21 +143,16 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
|
|
139
143
|
|
140
144
|
context 'when a target is set' do
|
141
145
|
let(:config) do
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
target => "[@metadata][_source]"
|
148
|
-
}
|
149
|
-
}
|
150
|
-
]
|
146
|
+
{
|
147
|
+
'hosts' => ["localhost"],
|
148
|
+
'query' => '{ "query": { "match": { "city_name": "Okinawa" } }, "fields": ["message"] }',
|
149
|
+
'target' => "[@metadata][_source]"
|
150
|
+
}
|
151
151
|
end
|
152
152
|
|
153
153
|
it 'creates the event using the target' do
|
154
|
-
|
155
|
-
|
156
|
-
end
|
154
|
+
plugin.run queue
|
155
|
+
event = queue.pop
|
157
156
|
|
158
157
|
expect(event).to be_a(LogStash::Event)
|
159
158
|
expect(event.get("[@metadata][_source][message]")).to eql [ "ohayo" ]
|
@@ -450,24 +449,21 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
|
|
450
449
|
allow_any_instance_of(described_class).to receive(:ecs_compatibility).and_return(ecs_compatibility)
|
451
450
|
end
|
452
451
|
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
elasticsearch {
|
458
|
-
hosts => ["localhost"]
|
459
|
-
query => '{ "query": { "match": { "city_name": "Okinawa" } }, "fields": ["message"] }'
|
460
|
-
docinfo => true
|
461
|
-
}
|
462
|
-
}
|
463
|
-
]
|
452
|
+
before do
|
453
|
+
if do_register
|
454
|
+
plugin.register
|
455
|
+
plugin.run queue
|
464
456
|
end
|
457
|
+
end
|
465
458
|
|
466
|
-
|
467
|
-
event = input(config_metadata) do |pipeline, queue|
|
468
|
-
queue.pop
|
469
|
-
end
|
459
|
+
let(:do_register) { true }
|
470
460
|
|
461
|
+
let(:event) { queue.pop }
|
462
|
+
|
463
|
+
context 'with docinfo enabled' do
|
464
|
+
let(:config) { base_config.merge 'docinfo' => true }
|
465
|
+
|
466
|
+
it "provides document info under metadata" do
|
471
467
|
if ecs_select.active_mode == :disabled
|
472
468
|
expect(event.get("[@metadata][_index]")).to eq('logstash-2014.10.12')
|
473
469
|
expect(event.get("[@metadata][_type]")).to eq('logs')
|
@@ -479,123 +475,72 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
|
|
479
475
|
end
|
480
476
|
end
|
481
477
|
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
478
|
+
context 'with docinfo_target' do
|
479
|
+
let(:config) { base_config.merge 'docinfo' => true, 'docinfo_target' => docinfo_target }
|
480
|
+
let(:docinfo_target) { 'metadata_with_hash' }
|
481
|
+
|
482
|
+
it 'merges values if the `docinfo_target` already exist in the `_source` document' do
|
483
|
+
expect(event.get("[metadata_with_hash][_index]")).to eq('logstash-2014.10.12')
|
484
|
+
expect(event.get("[metadata_with_hash][_type]")).to eq('logs')
|
485
|
+
expect(event.get("[metadata_with_hash][_id]")).to eq('C5b2xLQwTZa76jBmHIbwHQ')
|
486
|
+
expect(event.get("[metadata_with_hash][awesome]")).to eq("logstash")
|
487
|
+
end
|
488
|
+
|
489
|
+
context 'non-existent' do
|
490
|
+
let(:docinfo_target) { 'meta' }
|
491
|
+
|
492
|
+
it 'should move the document information to the specified field' do
|
493
|
+
expect(event.get("[meta][_index]")).to eq('logstash-2014.10.12')
|
494
|
+
expect(event.get("[meta][_type]")).to eq('logs')
|
495
|
+
expect(event.get("[meta][_id]")).to eq('C5b2xLQwTZa76jBmHIbwHQ')
|
496
|
+
end
|
493
497
|
|
494
|
-
event = input(config_metadata_with_hash) do |pipeline, queue|
|
495
|
-
queue.pop
|
496
498
|
end
|
497
499
|
|
498
|
-
expect(event.get("[metadata_with_hash][_index]")).to eq('logstash-2014.10.12')
|
499
|
-
expect(event.get("[metadata_with_hash][_type]")).to eq('logs')
|
500
|
-
expect(event.get("[metadata_with_hash][_id]")).to eq('C5b2xLQwTZa76jBmHIbwHQ')
|
501
|
-
expect(event.get("[metadata_with_hash][awesome]")).to eq("logstash")
|
502
500
|
end
|
503
501
|
|
504
502
|
context 'if the `docinfo_target` exist but is not of type hash' do
|
505
|
-
let
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
"docinfo_target" => 'metadata_with_string'
|
510
|
-
} }
|
511
|
-
it 'thows an exception if the `docinfo_target` exist but is not of type hash' do
|
503
|
+
let(:config) { base_config.merge 'docinfo' => true, "docinfo_target" => 'metadata_with_string' }
|
504
|
+
let(:do_register) { false }
|
505
|
+
|
506
|
+
it 'raises an exception if the `docinfo_target` exist but is not of type hash' do
|
512
507
|
expect(client).not_to receive(:clear_scroll)
|
513
508
|
plugin.register
|
514
509
|
expect { plugin.run([]) }.to raise_error(Exception, /incompatible event/)
|
515
510
|
end
|
516
|
-
end
|
517
|
-
|
518
|
-
it 'should move the document information to the specified field' do
|
519
|
-
config = %q[
|
520
|
-
input {
|
521
|
-
elasticsearch {
|
522
|
-
hosts => ["localhost"]
|
523
|
-
query => '{ "query": { "match": { "city_name": "Okinawa" } }, "fields": ["message"] }'
|
524
|
-
docinfo => true
|
525
|
-
docinfo_target => 'meta'
|
526
|
-
}
|
527
|
-
}
|
528
|
-
]
|
529
|
-
event = input(config) do |pipeline, queue|
|
530
|
-
queue.pop
|
531
|
-
end
|
532
511
|
|
533
|
-
expect(event.get("[meta][_index]")).to eq('logstash-2014.10.12')
|
534
|
-
expect(event.get("[meta][_type]")).to eq('logs')
|
535
|
-
expect(event.get("[meta][_id]")).to eq('C5b2xLQwTZa76jBmHIbwHQ')
|
536
512
|
end
|
537
513
|
|
538
|
-
|
539
|
-
|
540
|
-
config = %Q[
|
541
|
-
input {
|
542
|
-
elasticsearch {
|
543
|
-
hosts => ["localhost"]
|
544
|
-
query => '{ "query": { "match": { "city_name": "Okinawa" } }, "fields": ["message"] }'
|
545
|
-
docinfo => true
|
546
|
-
docinfo_fields => #{fields}
|
547
|
-
}
|
548
|
-
}]
|
514
|
+
context 'with docinfo_fields' do
|
515
|
+
let(:config) { base_config.merge 'docinfo' => true, "docinfo_fields" => ["_index"] }
|
549
516
|
|
550
|
-
|
551
|
-
|
517
|
+
it "allows to specify which fields from the document info to save to metadata" do
|
518
|
+
meta_base = event.get(ecs_select.active_mode == :disabled ? "@metadata" : "[@metadata][input][elasticsearch]")
|
519
|
+
expect(meta_base.keys).to eql ["_index"]
|
552
520
|
end
|
553
521
|
|
554
|
-
meta_base = event.get(ecs_select.active_mode == :disabled ? "@metadata" : "[@metadata][input][elasticsearch]")
|
555
|
-
expect(meta_base.keys).to eq(fields)
|
556
522
|
end
|
557
523
|
|
558
|
-
|
559
|
-
config
|
560
|
-
|
561
|
-
elasticsearch {
|
562
|
-
hosts => ["localhost"]
|
563
|
-
query => '{ "query": { "match": { "city_name": "Okinawa" } }, "fields": ["message"] }'
|
564
|
-
docinfo => true
|
565
|
-
add_field => {
|
566
|
-
'identifier' => "foo:%{[@metadata][_type]}:%{[@metadata][_id]}"
|
567
|
-
}
|
568
|
-
}
|
569
|
-
}
|
570
|
-
]
|
524
|
+
context 'add_field' do
|
525
|
+
let(:config) { base_config.merge 'docinfo' => true,
|
526
|
+
'add_field' => { 'identifier' => "foo:%{[@metadata][_type]}:%{[@metadata][_id]}" } }
|
571
527
|
|
572
|
-
|
573
|
-
|
574
|
-
end
|
528
|
+
it 'should be able to reference metadata fields in `add_field` decorations' do
|
529
|
+
expect(event.get('identifier')).to eq('foo:logs:C5b2xLQwTZa76jBmHIbwHQ')
|
530
|
+
end if ecs_select.active_mode == :disabled
|
575
531
|
|
576
|
-
|
577
|
-
end if ecs_select.active_mode == :disabled
|
532
|
+
end
|
578
533
|
|
579
534
|
end
|
580
535
|
|
581
|
-
|
536
|
+
context "when not defining the docinfo" do
|
537
|
+
let(:config) { base_config }
|
582
538
|
|
583
|
-
|
584
|
-
|
585
|
-
config = %q[
|
586
|
-
input {
|
587
|
-
elasticsearch {
|
588
|
-
hosts => ["localhost"]
|
589
|
-
query => '{ "query": { "match": { "city_name": "Okinawa" } }, "fields": ["message"] }'
|
590
|
-
}
|
591
|
-
}
|
592
|
-
]
|
593
|
-
event = input(config) do |pipeline, queue|
|
594
|
-
queue.pop
|
539
|
+
it 'should keep the document information in the root of the event' do
|
540
|
+
expect(event.get("[@metadata]")).to be_empty
|
595
541
|
end
|
596
|
-
|
597
|
-
expect(event.get("[@metadata]")).to be_empty
|
598
542
|
end
|
543
|
+
|
599
544
|
end
|
600
545
|
end
|
601
546
|
|
@@ -740,9 +685,7 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
|
|
740
685
|
begin
|
741
686
|
@server = WEBrick::HTTPServer.new :Port => 0, :DocumentRoot => ".",
|
742
687
|
:Logger => Cabin::Channel.get, # silence WEBrick logging
|
743
|
-
:StartCallback => Proc.new {
|
744
|
-
queue.push("started")
|
745
|
-
}
|
688
|
+
:StartCallback => Proc.new { queue.push("started") }
|
746
689
|
@port = @server.config[:Port]
|
747
690
|
@server.mount_proc '/' do |req, res|
|
748
691
|
res.body = '''
|
@@ -811,11 +754,9 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
|
|
811
754
|
@first_req_waiter.countDown()
|
812
755
|
end
|
813
756
|
|
814
|
-
|
815
|
-
|
816
757
|
@server.start
|
817
758
|
rescue => e
|
818
|
-
|
759
|
+
warn "ERROR in webserver thread #{e.inspect}\n #{e.backtrace.join("\n ")}"
|
819
760
|
# ignore
|
820
761
|
end
|
821
762
|
end
|
@@ -914,6 +855,8 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
|
|
914
855
|
|
915
856
|
plugin.register
|
916
857
|
end
|
858
|
+
|
859
|
+
after { plugin.do_stop }
|
917
860
|
end
|
918
861
|
end
|
919
862
|
|
@@ -942,13 +885,16 @@ describe LogStash::Inputs::Elasticsearch, :ecs_compatibility_support do
|
|
942
885
|
end
|
943
886
|
|
944
887
|
it "should properly schedule" do
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
888
|
+
begin
|
889
|
+
expect(plugin).to receive(:do_run) {
|
890
|
+
queue << LogStash::Event.new({})
|
891
|
+
}.at_least(:twice)
|
892
|
+
runner = Thread.start { plugin.run(queue) }
|
893
|
+
sleep 3.0
|
894
|
+
ensure
|
895
|
+
plugin.do_stop
|
896
|
+
runner.join if runner
|
897
|
+
end
|
952
898
|
expect(queue.size).to be >= 2
|
953
899
|
end
|
954
900
|
|
@@ -72,25 +72,45 @@ describe LogStash::Inputs::Elasticsearch do
|
|
72
72
|
|
73
73
|
describe 'against a secured elasticsearch', secure_integration: true do
|
74
74
|
|
75
|
+
# client_options is for an out-of-band helper
|
75
76
|
let(:client_options) { { :ca_file => ca_file, :user => user, :password => password } }
|
76
77
|
|
77
|
-
let(:config) { super().merge('user' => user, 'password' => password
|
78
|
+
let(:config) { super().merge('user' => user, 'password' => password) }
|
78
79
|
|
79
|
-
|
80
|
+
shared_examples 'secured_elasticsearch' do
|
81
|
+
it_behaves_like 'an elasticsearch index plugin'
|
80
82
|
|
81
|
-
|
83
|
+
context "incorrect auth credentials" do
|
82
84
|
|
83
|
-
|
84
|
-
|
85
|
-
|
85
|
+
let(:config) do
|
86
|
+
super().merge('user' => 'archer', 'password' => 'b0gus!')
|
87
|
+
end
|
86
88
|
|
87
|
-
|
89
|
+
let(:queue) { [] }
|
88
90
|
|
89
|
-
|
90
|
-
|
91
|
+
it "fails to run the plugin" do
|
92
|
+
expect { plugin.register }.to raise_error Elasticsearch::Transport::Transport::Errors::Unauthorized
|
93
|
+
end
|
91
94
|
end
|
92
95
|
end
|
93
96
|
|
97
|
+
context 'with ca_file' do
|
98
|
+
let(:config) { super().merge('ssl' => true, 'ca_file' => ca_file) }
|
99
|
+
it_behaves_like 'secured_elasticsearch'
|
100
|
+
end
|
101
|
+
|
102
|
+
context 'with `ca_trusted_fingerprint`' do
|
103
|
+
let(:ca_trusted_fingerprint) { File.read("spec/fixtures/test_certs/ca.der.sha256").chomp }
|
104
|
+
let(:config) { super().merge('ssl' => true, 'ca_trusted_fingerprint' => ca_trusted_fingerprint) }
|
105
|
+
|
106
|
+
if Gem::Version.create(LOGSTASH_VERSION) >= Gem::Version.create("8.3.0")
|
107
|
+
it_behaves_like 'secured_elasticsearch'
|
108
|
+
else
|
109
|
+
it 'raises a configuration error' do
|
110
|
+
expect { plugin }.to raise_exception(LogStash::ConfigurationError, a_string_including("ca_trusted_fingerprint"))
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
94
114
|
end
|
95
115
|
|
96
116
|
context 'setting host:port', integration: true do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: logstash-input-elasticsearch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-05-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,6 +86,20 @@ dependencies:
|
|
86
86
|
- - ">="
|
87
87
|
- !ruby/object:Gem::Version
|
88
88
|
version: 7.17.1
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
requirement: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - "~>"
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '1.0'
|
95
|
+
name: logstash-mixin-ca_trusted_fingerprint_support
|
96
|
+
prerelease: false
|
97
|
+
type: :runtime
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '1.0'
|
89
103
|
- !ruby/object:Gem::Dependency
|
90
104
|
requirement: !ruby/object:Gem::Requirement
|
91
105
|
requirements:
|
@@ -212,6 +226,20 @@ dependencies:
|
|
212
226
|
- - ">="
|
213
227
|
- !ruby/object:Gem::Version
|
214
228
|
version: '0'
|
229
|
+
- !ruby/object:Gem::Dependency
|
230
|
+
requirement: !ruby/object:Gem::Requirement
|
231
|
+
requirements:
|
232
|
+
- - "~>"
|
233
|
+
- !ruby/object:Gem::Version
|
234
|
+
version: 3.0.9
|
235
|
+
name: rufus-scheduler
|
236
|
+
prerelease: false
|
237
|
+
type: :development
|
238
|
+
version_requirements: !ruby/object:Gem::Requirement
|
239
|
+
requirements:
|
240
|
+
- - "~>"
|
241
|
+
- !ruby/object:Gem::Version
|
242
|
+
version: 3.0.9
|
215
243
|
description: This gem is a Logstash plugin required to be installed on top of the
|
216
244
|
Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
|
217
245
|
gem is not a stand-alone program
|
@@ -233,6 +261,7 @@ files:
|
|
233
261
|
- logstash-input-elasticsearch.gemspec
|
234
262
|
- spec/es_helper.rb
|
235
263
|
- spec/fixtures/test_certs/ca.crt
|
264
|
+
- spec/fixtures/test_certs/ca.der.sha256
|
236
265
|
- spec/fixtures/test_certs/ca.key
|
237
266
|
- spec/fixtures/test_certs/es.crt
|
238
267
|
- spec/fixtures/test_certs/es.key
|
@@ -266,6 +295,7 @@ summary: Reads query results from an Elasticsearch cluster
|
|
266
295
|
test_files:
|
267
296
|
- spec/es_helper.rb
|
268
297
|
- spec/fixtures/test_certs/ca.crt
|
298
|
+
- spec/fixtures/test_certs/ca.der.sha256
|
269
299
|
- spec/fixtures/test_certs/ca.key
|
270
300
|
- spec/fixtures/test_certs/es.crt
|
271
301
|
- spec/fixtures/test_certs/es.key
|