【发布时间】:2015-07-15 03:45:28
【问题描述】:
我正在尝试想出最好的方法来清除超过两周前的 logstash 服务器中的日志。
对于那些不知道的人,Logstash 将其日志存储在 Elasticsearch 中。我工作的地方有一个非常稳定的 ELK 堆栈(Elasticsearch/Logstash/Kibana)。
删除logstash索引的典型方法是使用如下curl命令:
#curl --user admin -XDELETE http://localhost:9200/logstash-2015.06.06
Enter host password for user 'admin':
{"acknowledged":true}
现在我正在寻找一种编程方式来更改 logstash 索引中的日期,以自动清除任何超过两周的索引。
我正在考虑使用 bash 来完成这项工作。
如果您有任何关于如何执行此操作的示例或您可能有的建议,我将不胜感激!
谢谢
谢谢!!但是你认为你可以帮助我使用 auth 来完成这项工作吗?
这是我迄今为止尝试过的:
[root@logs:~] #curator --help | grep -i auth
--http_auth TEXT Use Basic Authentication ex: user:pass
[root@logs:~] #curator delete indices --older-than 14 --time-unit days --timestring %Y.%m.%d --regex '^logstash-' --http_auth admin:secretsauce
Error: no such option: --http_auth
[root@logs:~] #curator delete indices --older-than 14 --time-unit days --timestring %Y.%m.%d --regex '^logstash-' --http_auth admin:secretsauce
Error: no such option: --http_auth
[root@logs:~] #curator delete indices --http_auth admin:secretsauce --older-than 14 --time-unit days --timestring %Y.%m.%d --regex '^logstash-'
Error: no such option: --http_auth
【问题讨论】:
标签: logstash