定时删除elasticsearch的index】的更多相关文章

#!/bin/bashfind /data/elasticsearch/data/kz-log/nodes/0/indices/ -type d -mtime +5 |  awk -F"/" '{print $9}' | grep -v kibana | uniq >esindex.txtcat /home/wwwad/.sh/esindex.txt | while read linedoecho ${line}curl -XDELETE "http://10.19.1…
从去年搭建了日志系统后,就没有去管它了,最近发现大半年各种日志的index也蛮多的,就想着写个脚本定时清理一下,把一些太久的日志清理掉. 脚本思路:通过获取index的尾部时间与我们设定的过期时间进行对比,如果是属于过期时间那么就进行删除,并写入日志.如果不是则不进行处理. 完整的脚本:(今天准备写个,翻下笔记发现去年就已经写好了) #!/bin/bash ###################################################### # $Name: clean_…
#!/bin/bashfind /data/elasticsearch/data/pro-kz-log/nodes/0/indices/ -type d -mtime +7 | awk -F"/" '{print $9}' | grep -v kibana | uniq > /home/wwwad/.sh/esindex.txtcat /home/wwwad/.sh/esindex.txt | while read linedoecho ${line}curl -XDELETE…
有的时候我们在使用ES时,由于资源有限或业务需求,我们只想保存最近一段时间的数据,所以有如下脚本可以定时删除数据 delete_es_by_day.sh #!/bin/sh # example: index_name=$ daycolumn=$ savedays=$ format_day=$ if [ ! -n "$savedays" ]; then echo "the args is not right,please input again...." exit f…
这里我们参考官网安装curator https://www.cookiesinn.org/elasticsearch_curator_delete_indices/ https://www.elastic.co/guide/en/elasticsearch/client/curator/5.4/installation.html https://blog.csdn.net/u013613428/article/details/78229090 https://blog.csdn.net/zou7…
curl -u 用户名:密码 -H'Content-Type:application/json' -d'{ "query": { "range": { "@timestamp": { "lt": "now-7d", "format": "epoch_millis" } } } } ' -XPOST "http://127.0.0.1:9200/*-*/_de…
localStorage简介 使用localStorage可以在浏览器中存储键值对的数据.经常被和localStorage一并提及的是sessionStorage,它们都可以在当浏览器中存储键值对的数据.但是它们之间的区别是:存储在localStorage的数据可以长期保留:而当页面会话结束(也就是当页面被关闭)时,存储在sessionStorage的数据会被清除. 另外需要注意的是,localStorage中的键值对总是以字符串的形式存储,并且只能访问当前域名下的数据,不能跨域名访问. 欢迎关…
点击进入:Linux shell crontab expdp 定时任务逻辑备份 定时删除旧文件 首先建一个备份数据库用批处理文件,内容如下: rem expdp sz set sz_file=SZ_%date:~0,4%%date:~5,2%%date:~8,2%.dmp set sz_logfile=SZ_%date:~0,4%%date:~5,2%%date:~8,2%.log expdp user/pwd schemas=user_schema directory=dump_dir DUM…
点击进入:Window bat expdp 定时任务逻辑备份 定时删除N天前的旧文件 创建sh脚本 [oracle@localhost ~]$ vi logicbackup.sh 添加脚本内容 #!/bin/sh # ################################################################## # Powered by Ironfo # ####################################################…
powershell  定时删除脚本 $today=Get-Date #"今天是:$today" #昨天 #"昨天是:$($today.AddDays(-1))" #明天 #"明天是:$($today.AddDays(1))" #一周前 #"一周前是: $($today.AddDays(-7))" #五个月前 #"五个月前:$($today.AddMonths(-5))" #十年之前 #"十年之前…