我正在尝试提供从两周以上的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}
Run Code Online (Sandbox Code Playgroud)
现在我正在寻找的是一种以编程方式更改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
Run Code Online (Sandbox Code Playgroud)
Mag*_*äck 11
使用策展人.要删除超过14天的索引,可以运行以下命令:
curator delete indices --older-than 14 --time-unit days --timestring %Y.%m.%d --regex '^logstash-'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7719 次 |
| 最近记录: |