openstack-ansible-ops/elk_metrics_6x/templates/_include_setup_template.yml.j2
Kevin Carter ca23f9a987 Update index retention policy to ensure its an int
The current variable, when there's only one host will result in 'false'
instead of 0, which is a jinja-ism however due to java-ism's "false" is
evaluated to 5 and that makes the index retention policy very wrong.

Change-Id: I2668e17c1cf15fe47842ff349ffa4f71c70257e5
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
2018-08-03 02:21:02 +00:00

44 lines
2.1 KiB
Django/Jinja

# A template is used to set the mapping in Elasticsearch
# By default template loading is enabled and the template is loaded.
# These settings can be adjusted to load your own template or overwrite existing ones.
# Set to false to disable template loading.
setup.template.enabled: {{ inventory_hostname == data_nodes[0] }}
# Template name. By default the template name is "{{ beat_name }}-%{[beat.version]}"
# The template name and pattern has to be set in case the elasticsearch index pattern is modified.
setup.template.name: "{{ beat_name }}-%{[beat.version]}"
# Template pattern. By default the template pattern is "-%{[beat.version]}-*" to apply to the default index settings.
# The first part is the version of the beat and then -* is used to match all daily indices.
# The template name and pattern has to be set in case the elasticsearch index pattern is modified.
setup.template.pattern: "{{ beat_name }}-%{[beat.version]}-*"
# Path to fields.yml file to generate the template
setup.template.fields: "${path.config}/fields.yml"
# Overwrite existing template
setup.template.overwrite: {{ inventory_hostname == data_nodes[0] }}
{% set shards = ((data_nodes | length) * 3) | int %}
# Elasticsearch template settings
setup.template.settings:
# A dictionary of settings to place into the settings.index dictionary
# of the Elasticsearch template. For more details, please check
# https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html
index:
number_of_shards: {{ shards }}
codec: best_compression
# This provides for an index split of up to 2 times the number of available shards
number_of_routing_shards: {{ (shards | int) * 2 }}
# The default number of replicas will be based on the number of data nodes
# within the environment with a limit of 2 replicas.
number_of_replicas: {{ elasticsearch_number_of_replicas | int }}
# A dictionary of settings for the _source field. For more details, please check
# https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-source-field.html
_source:
enabled: true