mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-06 17:22:49 +01:00
update soup; check for index before applying new index setting
Signed-off-by: reyesj2 <94730068+reyesj2@users.noreply.github.com>
This commit is contained in:
@@ -520,16 +520,7 @@ post_to_2.4.110() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
post_to_2.4.120() {
|
post_to_2.4.120() {
|
||||||
for idx in "so-detection" "so-detectionhistory" "so-case" "so-casehistory"; do
|
update_elasticsearch_index_settings
|
||||||
JSON_STRING=$( jq -n \
|
|
||||||
--arg INDEX_NAME "$idx" \
|
|
||||||
'{"settings": {"index.auto_expand_replicas":"0-2","index.lifecycle.name":($INDEX_NAME + "-logs")}}'
|
|
||||||
)
|
|
||||||
echo "Updating $idx index settings"
|
|
||||||
retry 5 15 "so-elasticsearch-query $idx/_settings -d "$JSON_STRING" -XPUT| grep '{\"acknowledged\":true}'"
|
|
||||||
echo ""
|
|
||||||
done
|
|
||||||
|
|
||||||
POSTVERSION=2.4.120
|
POSTVERSION=2.4.120
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -947,6 +938,23 @@ update_airgap_repo() {
|
|||||||
createrepo /nsm/repo
|
createrepo /nsm/repo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
update_elasticsearch_index_settings() {
|
||||||
|
# Update managed indices to reflect latest index template
|
||||||
|
for idx in "so-detection" "so-detectionhistory" "so-case" "so-casehistory"; do
|
||||||
|
JSON_STRING=$( jq -n --arg INDEX_NAME "$idx" '{"settings": {"index.auto_expand_replicas":"0-2","index.lifecycle.name":($INDEX_NAME + "-logs")}}')
|
||||||
|
echo "Checking if index \"$idx\" exists"
|
||||||
|
exists=$(curl -K /opt/so/conf/elasticsearch/curl.config -s -o /dev/null -w "%{http_code}" -k -L -H "Content-Type: application/json" "https://localhost:9200/$idx")
|
||||||
|
if [ $exists -eq 200 ]; then
|
||||||
|
echo "$idx index found..."
|
||||||
|
echo "Updating $idx index settings"
|
||||||
|
so-elasticsearch-query $idx/_settings -d "$JSON_STRING" -XPUT
|
||||||
|
echo -e "\n"
|
||||||
|
else
|
||||||
|
echo -e "Skipping $idx... index does not exist\n"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
update_salt_mine() {
|
update_salt_mine() {
|
||||||
echo "Populating the mine with mine_functions for each host."
|
echo "Populating the mine with mine_functions for each host."
|
||||||
set +e
|
set +e
|
||||||
|
|||||||
Reference in New Issue
Block a user