Last active
May 4, 2016 20:28
-
-
Save luissantos/e15a4787e48d748d82b88eccc69c2bc2 to your computer and use it in GitHub Desktop.
Delete ELK indices older than 30 days
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ES='http://127.0.0.1:9200'; D=$(date --date='1 month ago' +%Y.%m.%d); curl --silent $ES'/_cat/indices' | awk -v d="$D" '/logstash-/{ if ($3 <= "logstash-"d) print $3 }' | xargs -I {} curl --silent -XDELETE $ES'/{}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment