Ori.livneh has submitted this change and it was merged.

Change subject: Logstash: Configure Elasticsearch to automatically create 
indices
......................................................................


Logstash: Configure Elasticsearch to automatically create indices

Configure the Elasticsearch cluster used for Logstash storage to allow
automatic creation of a new index when a document is stored under an
index that does not currently exist. Without this change we would have
to setup a cron job to explicitly create a new index each day.

This changeset adds a parameter to the elasticsearch class to control
the action.auto_create_index configuration setting and defaults it to
false to preserve the original class behavior.

Change-Id: I2c21b11d291875e7d30a7229eb1ba32f702146c5
---
M manifests/role/logstash.pp
M modules/elasticsearch/manifests/init.pp
M modules/elasticsearch/templates/elasticsearch.yml.erb
3 files changed, 6 insertions(+), 2 deletions(-)

Approvals:
  Ori.livneh: Verified; Looks good to me, approved



diff --git a/manifests/role/logstash.pp b/manifests/role/logstash.pp
index e8aa1bf..624e365 100644
--- a/manifests/role/logstash.pp
+++ b/manifests/role/logstash.pp
@@ -19,6 +19,7 @@
         cluster_name         => "production-logstash-${::site}",
         heap_memory          => '5G',
         plugins_dir          => '/srv/deployment/elasticsearch/plugins',
+        auto_create_index    => true,
     }
 
     class { '::redis':
diff --git a/modules/elasticsearch/manifests/init.pp 
b/modules/elasticsearch/manifests/init.pp
index 296a5d3..8d0a4d4 100644
--- a/modules/elasticsearch/manifests/init.pp
+++ b/modules/elasticsearch/manifests/init.pp
@@ -19,6 +19,8 @@
 # - $master_eligible:  is this node eligible to be a master node?  Defaults to
 #       true.
 # - $holds_data: should this node hold data?  Defaults to true.
+# - $auto_create_index: should the cluster automatically create new indices?
+#       Defaults to false.
 #
 # == Sample usage:
 #
@@ -32,7 +34,8 @@
                     $plugins_dir = '/usr/share/elasticsearch/plugins',
                     $minimum_master_nodes = 1,
                     $master_eligible = true,
-                    $holds_data = true) {
+                    $holds_data = true,
+                    $auto_create_index = false) {
     # Check arguments
     if $cluster_name == 'elasticsearch' {
         fail('$cluster_name must not be set to "elasticsearch"')
diff --git a/modules/elasticsearch/templates/elasticsearch.yml.erb 
b/modules/elasticsearch/templates/elasticsearch.yml.erb
index d0ccdb2..9f70910 100644
--- a/modules/elasticsearch/templates/elasticsearch.yml.erb
+++ b/modules/elasticsearch/templates/elasticsearch.yml.erb
@@ -363,7 +363,7 @@
 # Require explicit index creation.  ES never autocreates the indexes the way we
 # like them.
 ##
-action.auto_create_index: false
+action.auto_create_index: <%= @auto_create_index %>
 
 ##
 # Protect against accidental close/delete operations on all indices. You can

-- 
To view, visit https://gerrit.wikimedia.org/r/107716
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2c21b11d291875e7d30a7229eb1ba32f702146c5
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BryanDavis <[email protected]>
Gerrit-Reviewer: Manybubbles <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to