@@ -19,6 +19,8 @@ INDEXER_URL="https://${INDEXER_HOSTNAME}:9200"
19
19
# curl settings shortcuts
20
20
C_AUTH=" -u admin:${INDEXER_PASSWORD} "
21
21
22
+ ALERTS_TEMPLATE=" /etc/wazuh-indexer/wazuh-template.json"
23
+
22
24
# ########################################################################
23
25
# Creates the rollover_policy ISM policy.
24
26
# Globals:
@@ -127,10 +129,9 @@ function generate_ism_config() {
127
129
# ########################################################################
128
130
function load_templates() {
129
131
# Load wazuh-template.json, needed for initial indices creation.
130
- local wazuh_template_path=" /etc/wazuh-indexer/wazuh-template.json"
131
132
echo " Will create 'wazuh' index template"
132
- if [ -f $wazuh_template_path ]; then
133
- cat $wazuh_template_path |
133
+ if [ -f " ${ALERTS_TEMPLATE} " ]; then
134
+ cat " ${ALERTS_TEMPLATE} " |
134
135
if ! curl -s -k ${C_AUTH} \
135
136
-X PUT " ${INDEXER_URL} /_template/wazuh" \
136
137
-o " ${LOG_FILE} " --create-dirs \
@@ -141,7 +142,7 @@ function load_templates() {
141
142
echo " SUCC: 'wazuh' template created or updated"
142
143
fi
143
144
else
144
- echo " ERROR: $wazuh_template_path not found"
145
+ echo " ERROR: ${ALERTS_TEMPLATE} not found"
145
146
fi
146
147
147
148
# Load template for ISM configuration indices
@@ -403,6 +404,15 @@ function main() {
403
404
shift 2
404
405
fi
405
406
;;
407
+ " -t" | " --template" )
408
+ if [ -z " ${2} " ]; then
409
+ echo " Error on arguments. Probably missing <template> after -t|--template"
410
+ show_help
411
+ else
412
+ ALERTS_TEMPLATE=" ${2} "
413
+ shift 2
414
+ fi
415
+ ;;
406
416
" -v" | " --verbose" )
407
417
set -x
408
418
shift
0 commit comments