ELK下es索引管理工具-curator_elk的curator配置

img
img

网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。

需要这份系统化的资料的朋友,可以戳这里获取

一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!

pip install elasticsearch-curator


**使用:**


**命令语法:**


命令行参数: curator [–config CONFIG.YML] [–dry-run] ACTION\_FILE.YML



$ curator --help
Usage: curator [OPTIONS] ACTION_FILE

Curator for Elasticsearch indices.
See http://elastic.co/guide/en/elasticsearch/client/curator/current
Options:
–config PATH Path to configuration file. Default: ~/.curator/curator.yml
–dry-run Do not perform any changes. # --dry-run参数在调试action_file时比较重要
–version Show the version and exit.
–help Show this message and exit.


**curator运行需两个配置文件:**


**config.yml:用于连接ES集群配置**


**action.yml:用于配置要执行的操作,文件名称可以随意命名**  
 **config.yml配置:**



cat curator.yml

Remember, leave a key empty ifthere is no value. None will be a string,

not a Python “NoneType”

client:
hosts:
- 172.16.10.23
- 172.16.10.24
- 172.16.10.25
port: 9200
url_prefix:
use_ssl: False
certificate:
client_cert:
client_key:
ssl_no_validate: False
http_auth:
timeout: 3600
master_only: False
logging:
loglevel: INFO

logfile: /home/test/curator.log

logfile:
logformat: default
blacklist: [‘elasticsearch’, ‘urllib3’]


**配置说明:**


* hosts:  
 同一个集群内节点IP,如果端口不同,可写成ip:port形式;只能一次使用一个集群。在主机设置中包含来自多个集群的节点将导致错误。
* port: 默认值是9200。这个值只适用于没有端口的主机。
* timeout: 默认值是30S,根据实际使用情况调整.
* logfile: 默认值是空的,会将执行结果输出到
* STDOUT或控制台。如果指定文件,会把执行日志输出到文件中,而不是控制台.
* blacklist: 默认值为’elasticsearch’, ‘urllib3’。Python模块不被输出。除非需要调试某些问题,  
 否则请使用默认值.  
 **ACTION\_FILE配置**


配置说明:关闭前缀为syslog- 并且 时间格式为 '%Y.%m.%d’的7天前的所有的文档.



cat action_close.yml


Remember, leave a key empty ifthere is no value. None will be a string,

not a Python “NoneType”

Also remember that all examples have 'disable_action’set to True. If you

want to use thisaction as a template, be sure to set thisto False after

copying it.

actions:
1:
action: close
description: >-
Close indices older than 30days (based on index name), forlogstash-
prefixed indices.
options:
delete_aliases: False
disable_action: False
filters: # filters下的配置都是隐含的逻辑“AND”操作链接.
- filtertype: pattern
kind: prefix
value: syslog-
- filtertype: age
source: name
direction: older
timestring: ‘%Y.%m.%d’
unit: days
unit_count: 7


**curator\_cli命令行命令行查看所有索引:**



![img](https://img-blog.csdnimg.cn/img_convert/2a7bf6e3cef6e843bb7bbe7e136dbca1.png)
![img](https://img-blog.csdnimg.cn/img_convert/28f216acd1bc2e46272c1ee1e939359b.png)
![img](https://img-blog.csdnimg.cn/img_convert/6f0729b0818f4724fd2fde50d57946ba.png)

**既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上软件测试知识点,真正体系化!**

**由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新**

**[需要这份系统化的资料的朋友,可以戳这里获取](https://bbs.youkuaiyun.com/topics/618631832)**

*由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新**

**[需要这份系统化的资料的朋友,可以戳这里获取](https://bbs.youkuaiyun.com/topics/618631832)**

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值