























#/bin/bash #指定日期(2个月前) DATA=`date -d "2 month ago" +%Y%m%d` #当前日期 time=`date` #删除2个月前的日志 curl -u elastic:222222 --insecure -XDELETE https://10.40.17.29:9200/*_${DATA}* if [ $? -eq 0 ];then echo $time"-->del $DATA log success.." >> /data/es-index-clear.log else echo $time"-->del $DATA log fail.." >> /tmp/es-index-clear.log fi 加入crontab 每天检查2个月前的日志并删除(每次只删除一天的索引日志) 50 23 * * * /bin/bash /data/shell/es-index-clear.sh > /dev/null 2>&1 表示该脚本将在每天的 23点50分 执行一次
View Code
删除第12月份的索引
curl -u elastic:Traasd --insecure -XDELETE http://localhost:9200/*-201712*
journalctl -u elasticsearch


删除释放配置结束
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。