You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add support for 'auto' setting for ilm_enabled (#838)
* Add support for 'auto' setting for ilm_enabled
Adds a new confifuration option for `ilm_enabled` - `auto`. Using `auto` will
enable ILM if the target Elasticsearch cluster is > 7.0, and has the ILM
feature enabled and available.
* Fix code review comments, log formatting
Removes puts statement, fixes indentation, and fixes misleading
log messages when either the default template is used, or when
a template cannot be found.
* Fix doc typo
Copy file name to clipboardExpand all lines: lib/logstash/outputs/elasticsearch/ilm.rb
+48-21Lines changed: 48 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -5,41 +5,66 @@ module Ilm
5
5
6
6
defsetup_ilm
7
7
returnunlessilm_enabled?
8
-
@logger.info("Using Index lifecycle management - this feature is currently in beta.")
9
-
@logger.warn"Overwriting supplied index name with rollover alias #{@ilm_rollover_alias}"if@index != LogStash::Outputs::ElasticSearch::CommonConfigs::DEFAULT_INDEX_NAME
@logger.info("Index Lifecycle Management is set to 'auto', but will be disabled - #{error}")
29
+
false
30
+
else
31
+
true
32
+
end
33
+
else
34
+
@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")
35
+
false
36
+
end
37
+
elsif@ilm_enabled.to_s == 'true'
38
+
ilm_ready,error=ilm_ready?
39
+
raiseLogStash::ConfigurationError,"Index Lifecycle Management is set to enabled in Logstash, but cannot be used - #{error}"unlessilm_ready
40
+
true
41
+
else
42
+
false
43
+
end
44
+
end
18
45
end
19
46
20
-
defverify_ilm_readiness
21
-
returnunlessilm_enabled?
47
+
defilm_on_by_default?
48
+
maximum_seen_major_version >= 7
49
+
end
22
50
51
+
defilm_ready?
23
52
# Check the Elasticsearch instance for ILM readiness - this means that the version has to be a non-OSS release, with ILM feature
raiseLogStash::ConfigurationError,"Index Lifecycle management is enabled in logstash, but not installed on your Elasticsearch cluster"iffeatures.nil? || ilm.nil?
30
-
raiseLogStash::ConfigurationError,"Index Lifecycle management is enabled in logstash, but not available in your Elasticsearch cluster"unlessilm['available']
31
-
raiseLogStash::ConfigurationError,"Index Lifecycle management is enabled in logstash, but not enabled in your Elasticsearch cluster"unlessilm['enabled']
raiseLogStash::ConfigurationError,"The specified ILM policy #{ilm_policy} does not exist on your Elasticsearch instance"unlessclient.ilm_policy_exists?(ilm_policy)
0 commit comments