es定时清理数据脚本
cat delete-es6-unauth-index.sh #!/bin/bash # # Define variables RETVAL=0 Port=9200 Ip=192.168.135.119 Time1=$(date +%Y.%m.%d) Time2=$(date +%Y.%m.%d -d "-7day") # Determine the user to execute if [ "$UID" -ne "$RETVAL" ];then echo "Must be root to run scripts" exit 1 fi # Load local functions [ -f /etc/init.d/functions ] && source /etc/init.d/functions # Delete index 7 days ago curl -XDELETE "http://$Ip:$Port/*${Time2}" >/dev/null 2>&1 RETVAL=$? if [ "$RETVAL" -eq 0 ];then action "delete elk 7 day ago index" /bin/true else action "delete elk 7 day ago index" /bin/false fi # Scripts return values exit $RETVAL
转载于: https://blog.51cto.com/11576296/2338281

浙公网安备 33010602011771号