Skip to content

Commit

Permalink
Update indexer-ism-init.sh (#81)
Browse files Browse the repository at this point in the history
Updates the script to upload the wazuh-template.json to the indexer.

Signed-off-by: Álex Ruiz <[email protected]>
  • Loading branch information
AlexRuiz7 committed Apr 24, 2024
1 parent 1bf998d commit b10e68e
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion distribution/src/bin/indexer-ism-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,24 @@ function generate_rollover_template() {
# Loads the index templates for the rollover policy to the indexer.
#########################################################################
function load_templates() {
# Note: the wazuh-template.json could also be loaded here.
# Load wazuh-template.json, needed for initial indices creation.
local wazuh_template_path="/etc/wazuh-indexer/wazuh-template.json"
echo "Will create 'wazuh' index template"
if [ -f $wazuh_template_path ]; then
cat $wazuh_template_path |
if ! curl -s -k ${C_AUTH} \
-X PUT "${INDEXER_URL}/_template/wazuh" \
-o "${LOG_FILE}" --create-dirs \
-H 'Content-Type: application/json' -d @-; then
echo " ERROR: 'wazuh' template creation failed"
exit 1
else
echo " SUCC: 'wazuh' template created or updated"
fi
else
echo " ERROR: $wazuh_template_path not found"
fi

echo "Will create index templates to configure the alias"
for alias in "${aliases[@]}"; do
generate_rollover_template "${alias}" |
Expand Down

0 comments on commit b10e68e

Please sign in to comment.