Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Delete Elasticsearch indexes per month
month="08"
logs=`curl -XGET 'localhost:9200/_cat/indices?v'|grep -oh -E "wazuh-.+\.$month\.[0-9][0-9]"|grep wazuh`
for i in $logs
do
l=`echo $i|grep wazuh`
if ! [ -z "$l" ]
then
echo $l
sleep 3
curl -XDELETE "localhost:9200/$l"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.