logstash-output-elasticsearch 10.0.1-java → 10.0.2-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/docs/index.asciidoc +3 -3
- data/lib/logstash/outputs/elasticsearch/common.rb +1 -1
- data/lib/logstash/outputs/elasticsearch/ilm.rb +8 -6
- data/lib/logstash/outputs/elasticsearch/template_manager.rb +2 -2
- data/logstash-output-elasticsearch.gemspec +1 -1
- data/spec/fixtures/template-with-policy-es7x.json +1 -2
- data/spec/integration/outputs/ilm_spec.rb +18 -0
- data/spec/integration/outputs/parent_spec.rb +10 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90b70ef694ca408c5fe028903d6c9b1b6151eb98e99ecf57566cbf938e8ba2e2
|
4
|
+
data.tar.gz: 0067f5844ee31e31ea545d5854aaad2e309b34c1148ad8c8e1685698eba3c96e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5ab0d62f7c399abde3fc3ca4df0a879ef792b95360f5ca78f61f2e24e1a3fc4aaab4436a3700f11c3238b9dcfa3ed9d425e0b8e321b6aa50d29720d0acc19d7e
|
7
|
+
data.tar.gz: 4f7719371b9af4b9d1b1a4223b39835416734252804739f60174f5cbb68a61a97376b7fe53c0ab7e8ff71ba7871138fc9f28dde9cb8cd4d88e1085e35e04801d
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
## 10.0.2
|
2
|
+
- Fixed bug where index patterns in custom templates could be erroneously overwritten [#861](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/861)
|
3
|
+
|
1
4
|
## 10.0.1
|
2
5
|
- Reverted `document_type` obsoletion [#844](https://github.com/logstash-plugins/logstash-output-elasticsearch/pull/844)
|
3
6
|
|
data/docs/index.asciidoc
CHANGED
@@ -126,9 +126,9 @@ See config below for an example:
|
|
126
126
|
[source,ruby]
|
127
127
|
output {
|
128
128
|
elasticsearch {
|
129
|
-
ilm_rollover_alias
|
130
|
-
ilm_pattern
|
131
|
-
ilm_policy
|
129
|
+
ilm_rollover_alias => "custom"
|
130
|
+
ilm_pattern => "000001"
|
131
|
+
ilm_policy => "custom_policy"
|
132
132
|
}
|
133
133
|
}
|
134
134
|
|
@@ -4,20 +4,22 @@ module LogStash; module Outputs; class ElasticSearch
|
|
4
4
|
ILM_POLICY_PATH = "default-ilm-policy.json"
|
5
5
|
|
6
6
|
def setup_ilm
|
7
|
-
return unless
|
8
|
-
if default_index?(@index) || !default_rollover_alias?(@ilm_rollover_alias)
|
7
|
+
return unless ilm_in_use?
|
9
8
|
logger.warn("Overwriting supplied index #{@index} with rollover alias #{@ilm_rollover_alias}") unless default_index?(@index)
|
10
9
|
@index = @ilm_rollover_alias
|
11
10
|
maybe_create_rollover_alias
|
12
11
|
maybe_create_ilm_policy
|
13
|
-
end
|
14
12
|
end
|
15
13
|
|
16
14
|
def default_rollover_alias?(rollover_alias)
|
17
15
|
rollover_alias == LogStash::Outputs::ElasticSearch::DEFAULT_ROLLOVER_ALIAS
|
18
16
|
end
|
19
17
|
|
20
|
-
def
|
18
|
+
def ilm_alias_set?
|
19
|
+
default_index?(@index) || !default_rollover_alias?(@ilm_rollover_alias)
|
20
|
+
end
|
21
|
+
|
22
|
+
def ilm_in_use?
|
21
23
|
return @ilm_actually_enabled if defined?(@ilm_actually_enabled)
|
22
24
|
@ilm_actually_enabled =
|
23
25
|
begin
|
@@ -28,7 +30,7 @@ module LogStash; module Outputs; class ElasticSearch
|
|
28
30
|
@logger.info("Index Lifecycle Management is set to 'auto', but will be disabled - #{error}")
|
29
31
|
false
|
30
32
|
else
|
31
|
-
|
33
|
+
ilm_alias_set?
|
32
34
|
end
|
33
35
|
else
|
34
36
|
@logger.info("Index Lifecycle Management is set to 'auto', but will be disabled - Your Elasticsearch cluster is before 7.0.0, which is the minimum version required to automatically run Index Lifecycle Management")
|
@@ -37,7 +39,7 @@ module LogStash; module Outputs; class ElasticSearch
|
|
37
39
|
elsif @ilm_enabled.to_s == 'true'
|
38
40
|
ilm_ready, error = ilm_ready?
|
39
41
|
raise LogStash::ConfigurationError,"Index Lifecycle Management is set to enabled in Logstash, but cannot be used - #{error}" unless ilm_ready
|
40
|
-
|
42
|
+
ilm_alias_set?
|
41
43
|
else
|
42
44
|
false
|
43
45
|
end
|
@@ -11,7 +11,7 @@ module LogStash; module Outputs; class ElasticSearch
|
|
11
11
|
|
12
12
|
|
13
13
|
template = get_template(plugin.template, plugin.maximum_seen_major_version)
|
14
|
-
add_ilm_settings_to_template(plugin, template) if plugin.
|
14
|
+
add_ilm_settings_to_template(plugin, template) if plugin.ilm_in_use?
|
15
15
|
plugin.logger.info("Attempting to install template", :manage_template => template)
|
16
16
|
install(plugin.client, template_name(plugin), template, plugin.template_overwrite)
|
17
17
|
rescue => e
|
@@ -43,7 +43,7 @@ module LogStash; module Outputs; class ElasticSearch
|
|
43
43
|
# if not and ILM is enabled, use the rollover alias
|
44
44
|
# else use the default value of template_name
|
45
45
|
def self.template_name(plugin)
|
46
|
-
plugin.
|
46
|
+
plugin.ilm_in_use? && !plugin.original_params.key?('template_name') ? plugin.ilm_rollover_alias : plugin.template_name
|
47
47
|
end
|
48
48
|
|
49
49
|
def self.default_template_path(es_major_version)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'logstash-output-elasticsearch'
|
3
|
-
s.version = '10.0.
|
3
|
+
s.version = '10.0.2'
|
4
4
|
s.licenses = ['apache-2.0']
|
5
5
|
s.summary = "Stores logs in Elasticsearch"
|
6
6
|
s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
|
@@ -395,6 +395,24 @@ if ESHelper.es_version_satisfies?(">= 6.6")
|
|
395
395
|
it_behaves_like 'an ILM enabled Logstash'
|
396
396
|
end
|
397
397
|
|
398
|
+
context 'with a set index and a custom index pattern' do
|
399
|
+
if ESHelper.es_version_satisfies?(">= 7.0")
|
400
|
+
let (:template) { "spec/fixtures/template-with-policy-es7x.json" }
|
401
|
+
else
|
402
|
+
let (:template) { "spec/fixtures/template-with-policy-es6x.json" }
|
403
|
+
end
|
404
|
+
|
405
|
+
let (:settings) { super.merge("template" => template,
|
406
|
+
"index" => "overwrite-4")}
|
407
|
+
|
408
|
+
it 'should not overwrite the index patterns' do
|
409
|
+
subject.register
|
410
|
+
sleep(1)
|
411
|
+
expect(@es.indices.get_template(name: "logstash")["logstash"]).to have_index_pattern("overwrite-*")
|
412
|
+
end
|
413
|
+
end
|
414
|
+
|
415
|
+
|
398
416
|
context 'with a custom template' do
|
399
417
|
let (:ilm_rollover_alias) { "the_cat_in_the_hat" }
|
400
418
|
let (:index) { ilm_rollover_alias }
|
@@ -24,18 +24,19 @@ if ESHelper.es_version_satisfies?(">= 5.6")
|
|
24
24
|
before do
|
25
25
|
# Add mapping and a parent document
|
26
26
|
index_url = "http://#{get_host_port()}/#{index}"
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
"relations" => { parent_relation => child_relation }
|
34
|
-
}
|
35
|
-
}
|
27
|
+
|
28
|
+
properties = {
|
29
|
+
"properties" => {
|
30
|
+
join_field => {
|
31
|
+
"type" => "join",
|
32
|
+
"relations" => { parent_relation => child_relation }
|
36
33
|
}
|
37
34
|
}
|
38
35
|
}
|
36
|
+
|
37
|
+
mapping = ESHelper.es_version_satisfies?('<7') ? { "mappings" => { type => properties } }
|
38
|
+
: { "mappings" => properties}
|
39
|
+
|
39
40
|
if ESHelper.es_version_satisfies?('<6')
|
40
41
|
mapping.merge!({
|
41
42
|
"settings" => {
|
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.0.
|
4
|
+
version: 10.0.2
|
5
5
|
platform: java
|
6
6
|
authors:
|
7
7
|
- Elastic
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|