Skip to content

Instantly share code, notes, and snippets.

@luissantos
Last active May 4, 2016 20:28
Show Gist options
  • Save luissantos/e15a4787e48d748d82b88eccc69c2bc2 to your computer and use it in GitHub Desktop.
Save luissantos/e15a4787e48d748d82b88eccc69c2bc2 to your computer and use it in GitHub Desktop.
Delete ELK indices older than 30 days
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