Skip to content

Instantly share code, notes, and snippets.

@csinchok
Created October 2, 2014 19:15
Show Gist options
  • Select an option

  • Save csinchok/844a34e7342cf7e8d913 to your computer and use it in GitHub Desktop.

Select an option

Save csinchok/844a34e7342cf7e8d913 to your computer and use it in GitHub Desktop.
Clear kibana indices older than 20 days
#!/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