删除elasticsearch中的旧索引 [英] Removing old indices in elasticsearch

查看:43
本文介绍了删除elasticsearch中的旧索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的许多日志都以 logstash-Year-Week 格式编入索引.也就是说,如果我想删除几周前的索引,我该如何在 elasticsearch 中实现这一点.有没有一种简单、无缝的方法来做到这一点?

I have the many of my logs indexed in logstash-Year-Week format. That is if i want to delete indices older than a few weeks, how can I achieve that in elasticsearch. Is there an easy, seamless way to do that?

推荐答案

Curator 是这里的理想搭档.您可以在此处找到链接 - https://github.com/elastic/curator

Curator would be an ideal match here. You can find the link here - https://github.com/elastic/curator

像下面这样的命令应该可以正常工作 -

A command like below should work just fine -

curator --host <IP> delete indices --older-than 30 --prefix "twitter-" --time-unit days  --timestring '%Y-%m-%d'

您可以将其保留在 CRON 中以偶尔删除索引.

You can keep in this in the CRON for removing the indices occasionally.

您可以在此处找到一些示例和文档 - https://www.elastic.co/guide/en/elasticsearch/client/curator/current/examples.html

You can find some examples and docs here - https://www.elastic.co/guide/en/elasticsearch/client/curator/current/examples.html

这篇关于删除elasticsearch中的旧索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆