initial pruning script, set to 10 days of history

This commit is contained in:
Jeff Bryner 2014-03-07 10:59:19 -08:00 коммит произвёл Anthony Verez
Родитель de2cde5891
Коммит f87ab1d7bc
1 изменённых файлов: 15 добавлений и 0 удалений

15
cron/pruneES.sh Executable file
Просмотреть файл

@ -0,0 +1,15 @@
#!/bin/bash
#figure out what we are archiving (events-YYYYMMDD index)
IDATE=`date --date='10 days ago' +"%Y%m%d"`
INDEXNAME="events-$IDATE" # this had better match the index name in ES
#maybe we were told what to archive.
if [[ ! -z $1 ]]
then
INDEXNAME=$1
fi
HOSTNAME=`hostname`
echo "Deleting index http://$HOSTNAME:9200/$INDEXNAME/"
curl -XDELETE "http://$HOSTNAME:9200/$INDEXNAME/"
echo "DONE"