4b8f46abee
This updates the fluent-logging chart to support the creation of an arbitrary number of templates for elasticsearch. This allows for the definition of multiple index mappings driven via the chart's values. This provides flexibility in determining specific structures for indexes that may differ between log types. This also moves to define these mappings via json instead of XML. As gotpl can convert yaml directly to json, and elasticsearch can ingest json directly for index creation, we no longer need an XML helper function to generate the required configuration. This helps reduce the number of helper functions we need to maintain Change-Id: I3c85fb9a1e700eb1592d96f83e632172d0eb2681
18 lines
525 B
Smarty
18 lines
525 B
Smarty
#!/bin/bash
|
|
|
|
set -ex
|
|
|
|
{{ range $template, $fields := .Values.conf.templates }}
|
|
|
|
result=$(curl -K- <<< "--user ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD}" \
|
|
-XPUT "${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}/_template/{{$template}}" \
|
|
-H 'Content-Type: application/json' -d @/tmp/{{$template}}.json \
|
|
| python -c "import sys, json; print json.load(sys.stdin)['acknowledged']")
|
|
if [ "$result" == "True" ]; then
|
|
echo "{{$template}} template created!"
|
|
else
|
|
echo "{{$template}} template not created!"
|
|
fi
|
|
|
|
{{ end }}
|