From f87ab1d7bce0fbb5726f08b929c969d62dfc67ab Mon Sep 17 00:00:00 2001 From: Jeff Bryner Date: Fri, 7 Mar 2014 10:59:19 -0800 Subject: [PATCH] initial pruning script, set to 10 days of history --- cron/pruneES.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 cron/pruneES.sh diff --git a/cron/pruneES.sh b/cron/pruneES.sh new file mode 100755 index 00000000..2100988d --- /dev/null +++ b/cron/pruneES.sh @@ -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"