Created
October 2, 2014 19:15
-
-
Save csinchok/844a34e7342cf7e8d913 to your computer and use it in GitHub Desktop.
Clear kibana indices older than 20 days
This file contains hidden or 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
| #!/bin/bash | |
| curl http://127.0.0.1:9200/_aliases 2>/dev/null | \ | |
| python -c "import json;import sys;sys.stdout.write('\n'.join([key for key in json.load(sys.stdin).keys() if key.startswith('logstash')]))" | \ | |
| sort -r | tail -n +20 | xargs -L 1 -I {} curl -XDELETE http://127.0.0.1:9200/{}/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment