From 46e0627ecf17bf9a5c1e47658418c8d6772a9c55 Mon Sep 17 00:00:00 2001 From: "Jason A. Gambino" Date: Fri, 13 Dec 2024 11:45:10 -0500 Subject: [PATCH] adding in new ism policies --- jobs/upload_opensearch_config/templates/bin/upload-config.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jobs/upload_opensearch_config/templates/bin/upload-config.erb b/jobs/upload_opensearch_config/templates/bin/upload-config.erb index d5009b09..5c2acb3d 100755 --- a/jobs/upload_opensearch_config/templates/bin/upload-config.erb +++ b/jobs/upload_opensearch_config/templates/bin/upload-config.erb @@ -116,7 +116,8 @@ echo "--- License" <% end %> echo "--- Creating ISM policy" -curl -XPUT ${CA} ${CERT} ${KEY} ${BASEURL}/_plugins/_ism/policies/logs-app-rollover_policy -H 'Content-Type: application/json' -d'{"policy":{"description":"Rollover to a new index when age or size becomes our target","default_state":"Rollover","states":[{"name":"Rollover","actions":[{"retry":{"count":3,"backoff":"exponential","delay":"1m"},"rollover":{"min_index_age":"'${INDEX_AGE}'","min_primary_shard_size":"'${DOCUMENT_SIZE}'","copy_alias":false}}],"transitions":[]}],"ism_template":[{"index_patterns":["logs-app-*"],"priority":100}]}}' +curl -XPUT ${CA} ${CERT} ${KEY} ${BASEURL}/_plugins/_ism/policies/logs-app-rollover_policy -H 'Content-Type: application/json' -d'{"policy":{"description":"Rollover to a new index when age or size becomes our target","default_state":"Rollover","states":[{"name":"Rollover","actions":[{"retry":{"count":3,"backoff":"exponential","delay":"1m"},"rollover":{"min_index_age":"'${INDEX_AGE}'","min_primary_shard_size":"'${DOCUMENT_SIZE}'","copy_alias":false}},{"read_only":{}}],"transitions":[{"state_name":"Old_index","conditions":{"min_index_age":"30d"}}]},{"name":"Old_index","actions":[{"retry":{"count":3,"backoff":"exponential","delay":"1m"},"force_merge":{"max_num_segments":1}}],"transitions":[{"state_name":"Delete_index","conditions":{"min_index_age":"365d"}}]},{"name":"Delete_index","actions":[{"retry":{"count":3,"backoff":"exponential","delay":"1m"},"delete":{}}],"transitions":[]}],"ism_template":[{"index_patterns":["logs-app-*"],"priority":100}]}}' +curl -XPUT ${CA} ${CERT} ${KEY} ${BASEURL}/_plugins/_ism/policies/logs_age_policy -H 'Content-Type: application/json' -d'{"policy":{"policy_id":"logs_app_policy","description":"age out old indexs","default_state":"Old_index","states":[{"name":"Old_index","actions":[{"retry":{"count":3,"backoff":"exponential","delay":"1m"},"force_merge":{"max_num_segments":1}}],"transitions":[{"state_name":"Delete_index","conditions":{"min_index_age":"365d"}}]},{"name":"Delete_index","actions":[{"retry":{"count":3,"backoff":"exponential","delay":"1m"},"delete":{}}],"transitions":[]}],"ism_template":null}}' HTTP_CODE=$(curl -s -o /dev/null -s -w "%{http_code}\n" -I ${CA} ${CERT} ${KEY} ${BASEURL}/_alias/${ALIAS}/ ) if [ "$HTTP_CODE" -ge "201" ]; then curl -XPUT ${CA} ${CERT} ${KEY} ${BASEURL}/%3Clogs-app-%7Bnow%2Fd%7D-01%3E -H 'Content-Type: application/json' -d'{"aliases": {"'${ALIAS}'": {}}}'