openstack-helm-infra/kibana/templates/bin/_create_kibana_index_patterns.sh.tpl
Radhika Pai e966ae6ba8 Kibana: Add support for arbitrary object definitions via
overrides

This allows for customizing the
indexes required by different deployment targets instead of
assuming all indexes are common for every type of deployment.

Change-Id: Iae9a35462400f7c8612ee7d0b49bfd6a20d3120c
2020-05-19 09:11:40 -05:00

30 lines
1.2 KiB
Smarty

#!/bin/bash
{{/*
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}
set -ex
{{- range $objectType, $indices := .Values.conf.create_kibana_indexes.indexes }}
{{- range $indices }}
curl -K- <<< "--user ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}" \
-XPOST "${KIBANA_ENDPOINT}/api/saved_objects/index-pattern/{{ . }}*" -H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' -d \
'{"attributes":{"title":"{{ . }}-*","timeFieldName":"@timestamp"}}'
{{- end }}
{{- end }}
curl -K- <<< "--user ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}" \
-XPOST "${KIBANA_ENDPOINT}/api/kibana/settings/defaultIndex" -H 'kbn-xsrf: true' \
-H 'Content-Type: application/json' -d \
'{"value" : "{{ .Values.conf.create_kibana_indexes.default_index }}*"}'