[kibana] enforce index creation for ELK > 5 (debian)
The default index isn't created automatically when using ELK > 5.x. This commit adds a new task into the post-deploy taskset to force the creation of the default index. This patch also enforces the kibana config to set index as defaultIndex without the need for the defaultIndex property to already exists , preventing the error exposed on the public bug. Also added a new option named kibana_default_index_options, with a default index.mapper.dynamic set to true, this option can be extended by the operator and they will be applied to the index. Change-Id: Ica63a5fb30947f7ebae6cf8c80500a7dd0907211 Closes-Bug: #1772687 Signed-off-by: Jorge Niedbalski <jorge.niedbalski@linaro.org>
This commit is contained in:
parent
2ca94a62d1
commit
317a107988
@ -18,3 +18,4 @@ path.data: "/var/lib/elasticsearch/data"
|
|||||||
path.logs: "/var/log/kolla/elasticsearch"
|
path.logs: "/var/log/kolla/elasticsearch"
|
||||||
path.scripts: "/etc/elasticsearch/scripts"
|
path.scripts: "/etc/elasticsearch/scripts"
|
||||||
indices.fielddata.cache.size: 40%
|
indices.fielddata.cache.size: 40%
|
||||||
|
action.auto_create_index: "true"
|
||||||
|
@ -29,7 +29,8 @@ kibana_default_index_pattern: "{{ kibana_log_prefix }}-*"
|
|||||||
kibana_default_index:
|
kibana_default_index:
|
||||||
title: "{{ kibana_default_index_pattern }}"
|
title: "{{ kibana_default_index_pattern }}"
|
||||||
timeFieldName: "@timestamp"
|
timeFieldName: "@timestamp"
|
||||||
|
kibana_default_index_options:
|
||||||
|
index.mapper.dynamic: true
|
||||||
|
|
||||||
####################
|
####################
|
||||||
# Docker
|
# Docker
|
||||||
|
@ -5,6 +5,15 @@
|
|||||||
port: "{{ kibana_server_port }}"
|
port: "{{ kibana_server_port }}"
|
||||||
run_once: true
|
run_once: true
|
||||||
|
|
||||||
|
- name: Register the kibana index in elasticsearch
|
||||||
|
uri:
|
||||||
|
url: "{{ internal_protocol }}://{{ kolla_internal_vip_address }}:{{ elasticsearch_port }}/.kibana"
|
||||||
|
method: PUT
|
||||||
|
body: "{{ kibana_default_index_options | to_json }}"
|
||||||
|
body_format: json
|
||||||
|
status_code: 200, 201
|
||||||
|
run_once: true
|
||||||
|
|
||||||
- name: Wait for kibana to register in elasticsearch
|
- name: Wait for kibana to register in elasticsearch
|
||||||
uri:
|
uri:
|
||||||
url: "{{ internal_protocol }}://{{ kolla_internal_vip_address }}:{{ elasticsearch_port }}/.kibana"
|
url: "{{ internal_protocol }}://{{ kolla_internal_vip_address }}:{{ elasticsearch_port }}/.kibana"
|
||||||
@ -15,6 +24,16 @@
|
|||||||
delay: 2
|
delay: 2
|
||||||
run_once: true
|
run_once: true
|
||||||
|
|
||||||
|
- name: Change kibana config to set index as defaultIndex
|
||||||
|
uri:
|
||||||
|
url: "{{ internal_protocol }}://{{ kolla_internal_vip_address }}:{{ elasticsearch_port }}/.kibana/config/*"
|
||||||
|
method: PUT
|
||||||
|
body:
|
||||||
|
defaultIndex: "{{ kibana_default_index_pattern }}"
|
||||||
|
body_format: json
|
||||||
|
status_code: 200, 201
|
||||||
|
run_once: true
|
||||||
|
|
||||||
- name: Get kibana default indexes
|
- name: Get kibana default indexes
|
||||||
uri:
|
uri:
|
||||||
HEADER_Content-Type: application/json
|
HEADER_Content-Type: application/json
|
||||||
@ -44,36 +63,3 @@
|
|||||||
- kibana_default_index is defined
|
- kibana_default_index is defined
|
||||||
- kibana_default_indexes is defined
|
- kibana_default_indexes is defined
|
||||||
- kibana_default_indexes['.kibana']['mappings']['config']['properties']['defaultIndex'] is not defined
|
- kibana_default_indexes['.kibana']['mappings']['config']['properties']['defaultIndex'] is not defined
|
||||||
|
|
||||||
- name: Find kibana version
|
|
||||||
command: docker exec -t kibana /opt/kibana/bin/kibana --version
|
|
||||||
register: kibana_version
|
|
||||||
run_once: true
|
|
||||||
changed_when: true
|
|
||||||
when:
|
|
||||||
- kibana_default_index is defined
|
|
||||||
- kibana_default_indexes is defined
|
|
||||||
- kibana_default_indexes['.kibana']['mappings']['config']['properties']['defaultIndex'] is not defined
|
|
||||||
|
|
||||||
- set_fact:
|
|
||||||
kibana_version: "{{ kibana_version.stdout }}"
|
|
||||||
run_once: true
|
|
||||||
connection: local
|
|
||||||
when:
|
|
||||||
- kibana_default_index is defined
|
|
||||||
- kibana_default_indexes is defined
|
|
||||||
- kibana_default_indexes['.kibana']['mappings']['config']['properties']['defaultIndex'] is not defined
|
|
||||||
|
|
||||||
- name: Change kibana config to set index as defaultIndex
|
|
||||||
uri:
|
|
||||||
url: "http://{{ kolla_internal_vip_address }}:{{ elasticsearch_port }}/.kibana/config/{{ kibana_version }}"
|
|
||||||
method: PUT
|
|
||||||
body:
|
|
||||||
defaultIndex: "{{ kibana_default_index_pattern }}"
|
|
||||||
body_format: json
|
|
||||||
status_code: 200
|
|
||||||
run_once: true
|
|
||||||
when:
|
|
||||||
- kibana_default_index is defined
|
|
||||||
- kibana_default_indexes is defined
|
|
||||||
- kibana_default_indexes['.kibana']['mappings']['config']['properties']['defaultIndex'] is not defined
|
|
||||||
|
Loading…
Reference in New Issue
Block a user