被elastalert虐了 (elastalert support_es5分支 + elasticsearch 5版本)

  • 目标, 使用elastalert 做elasticsearch的日志关键字报警。

  • 问题,master主线上的alert对于ES5的支持有问题

  • 有人说需要修改几个地方,大概是下面的三个

elastalert.py 修改
/usr/lib/python2.7/site-packages/elastalert-0.1.4-py2.7.egg/elastalert/elastalert.py

159
841
1025

直接使用支持ec5的分支

# 这个方法是靠谱的,直接下载然后立马checkout,别checkout之后打个包然后扔到另外的一个机器上,避免其他问题,直接checkout
mkdir aaa
git clone https://github.com/Yelp/elastalert.git .
git checkout support_es5
python setup.py install
pip install -r requirements.txt

日志

# 这个是发送日志的时候要包括哪些字段,无意中看到的,觉得意思就写在这儿了,我这儿今儿还没收到alert来。
include: ["@timestamp", "logLevel", "message"]
https://github.com/Yelp/elastalert#how-can-i-change-whats-in-the-alert

帮助比较大

  • 关于alert的配置,最最关键的就是filter的设置,有expreg,有wildmark,以后query,只有expreg这个有点效果,可以测试中海油问题。
    • 比如我测试aaa.bbb可以
    • 比如我测试 aaa.bbb.ccc就不可以.
https://github.com/Yelp/elastalert/issues/719

Can only use regexp queries on keyword and text fields

保留一下我的小配置

es_host: 192.168.0.xxx
es_port: 9200
name: Example rule
use_strftine_index: true
type: frequency
index: filebeat-*
num_events: 1
timeframe:
  hours: 1
filter:
  - regexp:
      message: ".*aaa.bbb.ccc.*"
alert:
- "email"
email:
- "xxx@xxx.com"

今儿就到这儿。

参考

  1. http://elastalert.readthedocs.io/en/latest/recipes/writing_filters.html#writingfilters
  2. http://elastalert.readthedocs.io/en/latest/running_elastalert.html?highlight=num_events
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值