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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5437ab2d215d988d230d11363dddb6759fca10691dc89c4bb6fb64ee9963e125
4
- data.tar.gz: 9815fd0ac531dd9d345045a4fbcd912c8a552f49abcccb01c5ec97e223ef907b
3
+ metadata.gz: 90b70ef694ca408c5fe028903d6c9b1b6151eb98e99ecf57566cbf938e8ba2e2
4
+ data.tar.gz: 0067f5844ee31e31ea545d5854aaad2e309b34c1148ad8c8e1685698eba3c96e
5
5
  SHA512:
6
- metadata.gz: 5f9273bdbcc946ee9fa7b646aa8a924432e618f2b5cfa5def541ffed237e7b365fd68a36b486cc6d30f049e3d1f7a40d31322fbcfca03c60be6fe2c38ff7020d
7
- data.tar.gz: d607546d21651f80d4f0207d2e967ef03520a7faa40be4cc66507e972a6bf5b7763e9a701d2b9d5e98f3587a9bc4a9bca509789f545908d6b2fa01be1be4dd72
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: "custom"
130
- ilm_pattern: "000001"
131
- ilm_policy: "custom_policy"
129
+ ilm_rollover_alias => "custom"
130
+ ilm_pattern => "000001"
131
+ ilm_policy => "custom_policy"
132
132
  }
133
133
  }
134
134
 
@@ -48,7 +48,7 @@ module LogStash; module Outputs; class ElasticSearch;
48
48
  end
49
49
  if successful_connection?
50
50
  install_template
51
- setup_ilm if ilm_enabled?
51
+ setup_ilm if ilm_in_use?
52
52
  end
53
53
  end
54
54
  end
@@ -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 ilm_enabled?
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 ilm_enabled?
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
- true
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
- true
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.ilm_enabled?
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.ilm_enabled? && !plugin.original_params.key?('template_name') ? plugin.ilm_rollover_alias : plugin.template_name
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.1'
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"
@@ -6,7 +6,6 @@
6
6
  "number_of_shards": 1
7
7
  },
8
8
  "mappings" : {
9
- "_doc" : {
10
9
  "dynamic_templates" : [ {
11
10
  "message_field" : {
12
11
  "path_match" : "message",
@@ -42,5 +41,5 @@
42
41
  }
43
42
  }
44
43
  }
45
- }
44
+
46
45
  }
@@ -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
- mapping = {
28
- "mappings" => {
29
- type => {
30
- "properties" => {
31
- join_field => {
32
- "type" => "join",
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.1
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-02-06 00:00:00.000000000 Z
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