Skip to content

Commit

Permalink
adding in new ism policies
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonTheMain committed Dec 13, 2024
1 parent fa35085 commit 46e0627
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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}'": {}}}'
Expand Down

0 comments on commit 46e0627

Please sign in to comment.