CentOS下ELK基于ElastAlert实现日志的微信报警_writeback_index (1)

img
img
img

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

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

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

$ cd /app
$ git clone https://github.com/Yelp/elastalert.git


安装模块:



$ pip install “setuptools>=11.3”
$ python setup.py install


根据Elasticsearch的版本,您可能需要手动安装正确版本的elasticsearch-py。


Elasticsearch 5.0+:



$ pip install “elasticsearch>=5.0.0”


Elasticsearch 2.X:



$ pip install “elasticsearch<3.0.0”


## 3. 配置ElastAlert


配置config.yaml 文件



$ cp config.yaml.example config.yaml
$ cat config.yaml
rules_folder: example_rules
run_every:
seconds: 10
buffer_time:
minutes: 15
es_host: 10.1.144.208
es_port: 9201
#es_username: elastic
#es_password: 123456
writeback_index: elastalert_status
alert_time_limit:
days: 2


**rules\_folder**:ElastAlert从中加载规则配置文件的位置。它将尝试加载文件夹中的每个.yaml文件。没有任何有效规则,ElastAlert将无法启动。  
 **run\_every**: ElastAlert多久查询一次Elasticsearch的时间。  
 **buffer\_time**:查询窗口的大小,从运行每个查询的时间开始向后延伸。对于其中use\_count\_query或use\_terms\_query设置为true的规则,将忽略此值。  
 **es\_host**:是Elasticsearch群集的地址,ElastAlert将在其中存储有关其状态,查询运行,警报和错误的数据。  
 **es\_port**:es对应的端口。  
 **es\_username**: 可选的; 用于连接的basic-auth用户名es\_host。  
 **es\_password**: 可选的; 用于连接的basic-auth密码es\_host。  
 **es\_send\_get\_body\_as**: 可选的; 方法查询Elasticsearch - GET,POST或source。默认是GET  
 **writeback\_index**:ElastAlert将在其中存储数据的索引的名称。我们稍后将创建此索引。  
 **alert\_time\_limit**: 失败警报的重试窗口。


**创建elastalert-create-index索引**



$ elastalert-create-index
New index name (Default elastalert_status)
Name of existing index

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值