logstash-output-elasticsearch 10.5.0-java → 10.7.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (21) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/docs/index.asciidoc +80 -50
  4. data/lib/logstash/outputs/elasticsearch.rb +33 -0
  5. data/lib/logstash/outputs/elasticsearch/common.rb +21 -8
  6. data/lib/logstash/outputs/elasticsearch/common_configs.rb +3 -3
  7. data/lib/logstash/outputs/elasticsearch/ilm.rb +1 -1
  8. data/lib/logstash/outputs/elasticsearch/template_manager.rb +12 -9
  9. data/lib/logstash/outputs/elasticsearch/{elasticsearch-template-es2x.json → templates/ecs-disabled/elasticsearch-2x.json} +0 -0
  10. data/lib/logstash/outputs/elasticsearch/{elasticsearch-template-es5x.json → templates/ecs-disabled/elasticsearch-5x.json} +0 -0
  11. data/lib/logstash/outputs/elasticsearch/{elasticsearch-template-es6x.json → templates/ecs-disabled/elasticsearch-6x.json} +0 -0
  12. data/lib/logstash/outputs/elasticsearch/{elasticsearch-template-es7x.json → templates/ecs-disabled/elasticsearch-7x.json} +0 -0
  13. data/lib/logstash/outputs/elasticsearch/{elasticsearch-template-es8x.json → templates/ecs-disabled/elasticsearch-8x.json} +0 -0
  14. data/lib/logstash/outputs/elasticsearch/templates/ecs-v1/elasticsearch-6x.json +2950 -0
  15. data/lib/logstash/outputs/elasticsearch/templates/ecs-v1/elasticsearch-7x.json +2948 -0
  16. data/logstash-output-elasticsearch.gemspec +2 -1
  17. data/spec/integration/outputs/ilm_spec.rb +2 -2
  18. data/spec/unit/outputs/elasticsearch/template_manager_spec.rb +9 -3
  19. data/spec/unit/outputs/elasticsearch_spec.rb +23 -1
  20. data/spec/unit/outputs/error_whitelist_spec.rb +1 -1
  21. metadata +23 -7
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-elasticsearch'
3
- s.version = '10.5.0'
3
+ s.version = '10.7.0'
4
4
 
5
5
  s.licenses = ['apache-2.0']
6
6
  s.summary = "Stores logs in Elasticsearch"
@@ -25,6 +25,7 @@ Gem::Specification.new do |s|
25
25
  s.add_runtime_dependency 'stud', ['>= 0.0.17', '~> 0.0']
26
26
  s.add_runtime_dependency 'cabin', ['~> 0.6']
27
27
  s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
28
+ s.add_runtime_dependency 'logstash-mixin-ecs_compatibility_support', '~>1.0'
28
29
 
29
30
  s.add_development_dependency 'logstash-codec-plain'
30
31
  s.add_development_dependency 'logstash-devutils'
@@ -249,9 +249,9 @@ if ESHelper.es_version_satisfies?(">= 6.6")
249
249
  }
250
250
  let (:small_max_doc_policy) { max_docs_policy(3) }
251
251
  let (:large_max_doc_policy) { max_docs_policy(1000000) }
252
- let (:expected_index) { LogStash::Outputs::ElasticSearch::DEFAULT_ROLLOVER_ALIAS }
252
+ let (:expected_index) { elasticsearch_output_plugin.default_ilm_rollover_alias }
253
253
 
254
- subject { LogStash::Outputs::ElasticSearch.new(settings) }
254
+ subject(:elasticsearch_output_plugin) { LogStash::Outputs::ElasticSearch.new(settings) }
255
255
 
256
256
  before :each do
257
257
  # Delete all templates first.
@@ -8,18 +8,24 @@ describe LogStash::Outputs::ElasticSearch::TemplateManager do
8
8
  describe ".default_template_path" do
9
9
  context "elasticsearch 1.x" do
10
10
  it "chooses the 2x template" do
11
- expect(described_class.default_template_path(1)).to match(/elasticsearch-template-es2x.json/)
11
+ expect(described_class.default_template_path(1)).to end_with("/templates/ecs-disabled/elasticsearch-2x.json")
12
12
  end
13
13
  end
14
14
  context "elasticsearch 2.x" do
15
15
  it "chooses the 2x template" do
16
- expect(described_class.default_template_path(2)).to match(/elasticsearch-template-es2x.json/)
16
+ expect(described_class.default_template_path(2)).to end_with("/templates/ecs-disabled/elasticsearch-2x.json")
17
17
  end
18
18
  end
19
19
  context "elasticsearch 5.x" do
20
20
  it "chooses the 5x template" do
21
- expect(described_class.default_template_path(5)).to match(/elasticsearch-template-es5x.json/)
21
+ expect(described_class.default_template_path(5)).to end_with("/templates/ecs-disabled/elasticsearch-5x.json")
22
22
  end
23
23
  end
24
24
  end
25
+
26
+ context 'when ECS v1 is requested' do
27
+ it 'resolves' do
28
+ expect(described_class.default_template_path(7, :v1)).to end_with("/templates/ecs-v1/elasticsearch-7x.json")
29
+ end
30
+ end
25
31
  end
@@ -6,7 +6,7 @@ require "logstash/outputs/elasticsearch"
6
6
  describe LogStash::Outputs::ElasticSearch do
7
7
  subject { described_class.new(options) }
8
8
  let(:options) { {} }
9
- let(:maximum_seen_major_version) { rand(100) }
9
+ let(:maximum_seen_major_version) { [1,2,5,6,7,8].sample }
10
10
 
11
11
  let(:do_register) { true }
12
12
 
@@ -355,6 +355,28 @@ describe LogStash::Outputs::ElasticSearch do
355
355
  end
356
356
  end
357
357
 
358
+ describe "the pipeline option" do
359
+ context "with a sprintf and set pipeline" do
360
+ let(:options) { {"pipeline" => "%{pipeline}" } }
361
+
362
+ let(:event) { LogStash::Event.new("pipeline" => "my-ingest-pipeline") }
363
+
364
+ it "should interpolate the pipeline value and set it" do
365
+ expect(subject.event_action_tuple(event)[1]).to include(:pipeline => "my-ingest-pipeline")
366
+ end
367
+ end
368
+
369
+ context "with a sprintf and empty pipeline" do
370
+ let(:options) { {"pipeline" => "%{pipeline}" } }
371
+
372
+ let(:event) { LogStash::Event.new("pipeline" => "") }
373
+
374
+ it "should interpolate the pipeline value but not set it because it is empty" do
375
+ expect(subject.event_action_tuple(event)[1]).not_to include(:pipeline)
376
+ end
377
+ end
378
+ end
379
+
358
380
  describe "SSL end to end" do
359
381
  let(:do_register) { false } # skip the register in the global before block, as is called here.
360
382
 
@@ -11,10 +11,10 @@ describe "whitelisting error types in expected behavior" do
11
11
 
12
12
  before :each do
13
13
  allow(subject.logger).to receive(:warn)
14
+ allow(subject).to receive(:maximum_seen_major_version).and_return(0)
14
15
 
15
16
  subject.register
16
17
 
17
- allow(subject.client).to receive(:maximum_seen_major_version).and_return(0)
18
18
  allow(subject.client).to receive(:get_xpack_info)
19
19
  allow(subject.client).to receive(:bulk).and_return(
20
20
  {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-elasticsearch
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.5.0
4
+ version: 10.7.0
5
5
  platform: java
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-22 00:00:00.000000000 Z
11
+ date: 2020-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -84,6 +84,20 @@ dependencies:
84
84
  - - "<="
85
85
  - !ruby/object:Gem::Version
86
86
  version: '2.99'
87
+ - !ruby/object:Gem::Dependency
88
+ requirement: !ruby/object:Gem::Requirement
89
+ requirements:
90
+ - - "~>"
91
+ - !ruby/object:Gem::Version
92
+ version: '1.0'
93
+ name: logstash-mixin-ecs_compatibility_support
94
+ prerelease: false
95
+ type: :runtime
96
+ version_requirements: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - "~>"
99
+ - !ruby/object:Gem::Version
100
+ version: '1.0'
87
101
  - !ruby/object:Gem::Dependency
88
102
  requirement: !ruby/object:Gem::Requirement
89
103
  requirements:
@@ -159,17 +173,19 @@ files:
159
173
  - lib/logstash/outputs/elasticsearch/common.rb
160
174
  - lib/logstash/outputs/elasticsearch/common_configs.rb
161
175
  - lib/logstash/outputs/elasticsearch/default-ilm-policy.json
162
- - lib/logstash/outputs/elasticsearch/elasticsearch-template-es2x.json
163
- - lib/logstash/outputs/elasticsearch/elasticsearch-template-es5x.json
164
- - lib/logstash/outputs/elasticsearch/elasticsearch-template-es6x.json
165
- - lib/logstash/outputs/elasticsearch/elasticsearch-template-es7x.json
166
- - lib/logstash/outputs/elasticsearch/elasticsearch-template-es8x.json
167
176
  - lib/logstash/outputs/elasticsearch/http_client.rb
168
177
  - lib/logstash/outputs/elasticsearch/http_client/manticore_adapter.rb
169
178
  - lib/logstash/outputs/elasticsearch/http_client/pool.rb
170
179
  - lib/logstash/outputs/elasticsearch/http_client_builder.rb
171
180
  - lib/logstash/outputs/elasticsearch/ilm.rb
172
181
  - lib/logstash/outputs/elasticsearch/template_manager.rb
182
+ - lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-2x.json
183
+ - lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-5x.json
184
+ - lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-6x.json
185
+ - lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-7x.json
186
+ - lib/logstash/outputs/elasticsearch/templates/ecs-disabled/elasticsearch-8x.json
187
+ - lib/logstash/outputs/elasticsearch/templates/ecs-v1/elasticsearch-6x.json
188
+ - lib/logstash/outputs/elasticsearch/templates/ecs-v1/elasticsearch-7x.json
173
189
  - logstash-output-elasticsearch.gemspec
174
190
  - spec/es_spec_helper.rb
175
191
  - spec/fixtures/_nodes/2x_1x.json