对应rule的一些公用规则,可以放到一个或者多个头文件中。主的rule yaml文件引入即可。文件名随意,最好别用yaml后缀,要不会被当做一个rule。另外import在rule文件中只能出现一次。多个头文件的话可以import文件中引入另外一个import。

示例:

主的myrule.yaml:

import: inc_es.inc
name: hs_server_ahc_task system error type: frequency # (Required)
# Index to search, wildcard supported
index: hs_server_ahc_task* # (Required, frequency specific)
# Alert when this many documents matching the query occur within a timeframe
num_events: 1 # (Required, frequency specific)
# num_events must occur within this amount of time to trigger an alert
timeframe:
hours: 1 #import: inc_time_field.inc filter:
- terms:
"Level": ["fatal", "error"] alert_subject: "Alert: System {0} occurred {1} times."
alert_subject_args:
- Level
- "num_hits"

被import的  inc_es.inc 文件:

es_host: 10.10.21.77

# (Optional)
# Elasticsearch port
es_port: 9200 attach_related: true
use_kibana4_dashboard: https://nodejsgbl.italkbb.com/kibana/app/kibana#/dashboard/3bde48d0-9880-11e9-b5d5-2df46b09dea6 email_format: html import: inc_mail.inc

这个又引入 mail.inc

alert:

- "email"

email:
- "bin.zhi@net263.com"
#- "zhibingoo@163.com"
#- "fsha@net263.com"
#- "tiezhou.wei@net263.com" smtp_host: smtp.263.net
smtp_port: 25
smtp_auth_file: ../smtp_auth_file.yaml
email_reply_to: No.reply@net263.com
from_addr: ElastAlert@net263.com
#cc: bin.zhi@net263.com

运行:

elastalert --config ../config.yaml --rule hs_ahc_task.yaml  --verbose  --start 2019-06-27T08:45 --end 2019-06-27T09:55

elastalert 用import属性来组织,引入配置的更多相关文章

  1. 在jsp中,page指令的()属性用来引入需要的包或类。

    在jsp中,page指令的()属性用来引入需要的包或类. A.extends B.import C.language D.contentType 解答:B

  2. Flutter路由_fluro引入配置和使用

    Flutter本身提供了路由机制,作个人的小型项目,完全足够了.但是如果你要作企业级开发,可能就会把入口文件变得臃肿不堪.而再Flutter问世之初,就已经了企业级路由方案fluro. flutter ...

  3. SpringBoot 属性配置文件数据注入配置和yml与properties区别

    前言 我们知道SpringBoot 通过配置类来解放一堆的xml文件配置,通属性配置文件,来进行,系统全局属性配置,这样极大的简化了我们开发过程,java web 也可以甜甜的从此 快速配置 Spri ...

  4. Android 100多个Styles快速开发布局XML,一行搞定View属性,一键统一配置UI...

    Android开发中大量使用XML代码作为界面的布局,使用styles能大幅精简XML代码. 比如下面这个界面从AlertDialog至PlacePickerWindow有19个样式相同的跳转Item ...

  5. spring 最全MAVEN 依赖引入配置

    <properties> <spring.version>4.1.6.RELEASE</spring.version> </properties> &l ...

  6. page指令import属性实例

    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"% ...

  7. create-react-app:reject和不reject(使用react-app-rewired)这2种情况下的antd组件按需引入配置

    create-react-app:eject和不eject(使用react-app-rewired)这2种情况下的antd组件按需引入配置: 不eject(使用react-app-rewired)配置 ...

  8. OpenGLES 与 WebGL 中顶点属性的组织格式的误解 - 一个不好笑的笑话

    版权声明:本文为博主原创文章,未经博主同意不得转载.转载联系 QQ 30952589.加好友请注明来意. https://blog.csdn.net/sleks/article/details/289 ...

  9. 小D课堂-SpringBoot 2.x微信支付在线教育网站项目实战_2-7.接口配置文件自动映射到属性和实体类配置

    笔记 7.接口配置文件自动映射到属性和实体类配置     简介:使用@value注解配置文件自动映射到属性和实体类 1.添加 @Component或者Configuration 注解:        ...

随机推荐

  1. nuxt 项目设置缩进为4个空格

    1..editorconfig 文件下的indent_size: 2更改为indent_size: 4 2..prettierrc 文件 { "singleQuote": true ...

  2. 调皮的js

    一.中文变量名 今天偶然看文章.看到js的var还可以用中文做变量名,那么我们试试,看看中文的变量名是否能打印出值呢? var 临时变量="111"; console.log(临时 ...

  3. 【Postgres】Windows2012 不能启动

    PG启动错误-不知道什么错误 等待 postgresql-x64- 服务的连接超时( 毫秒). 由于下列错误,postgresql-x64- 服务启动失败: 服务没有及时响应启动或控制请求. 编写ba ...

  4. C 语言项目中.h文件和.c文件的关系

    http://blog.csdn.net/xingkong_678/article/details/38639847 关于两者以前的关系,要从N年以前说起了~ long long ago,once a ...

  5. memoryDiary

    What did you accomplish today? , did you exercise today? Do you care about the people around you tod ...

  6. [ARC064F] Rotated Palindromes

    题意 给定一个整数N,请你求出有多少字符集为1到K之间整数的字符串,使得该字符串可以由一个长度为N的回文串循环移位后得到.所谓循环移位,就是把字符串的某个前缀(可以为空)移到字符串末尾,如" ...

  7. 08_MSTP(数通华为)

    1. 网络拓扑 2. SW1配置[SW1]vlan batch 10 20 30 40[SW1]stp mode mstp 进入MSTP配置视图,MSTP域名为huawei,同时配置VLAN到实例的映 ...

  8. pipelinewise 学习二 创建一个简单的pipeline

    pipelinewise 提供了方便的创建简单pipeline的命令,可以简化pipeline 的创建,同时也可以帮我们学习 生成demo pipeline pipelinewise init --n ...

  9. 第04组alpha冲刺(2/4)

    队名:斗地组 组长博客:地址 作业博客:Alpha冲刺(2/4) 各组员情况 林涛(组长) 过去两天完成了哪些任务: 1.收集各个组员的进度 2.写博客 展示GitHub当日代码/文档签入记录: 接下 ...

  10. Django 的 slug url 正则匹配

    如果按照 .* 去匹配,最后会把 /edit/ 和 /delete/ 也匹配进去. urlpatterns = [ #... url(r'^(?P<slug>.*)/$', post_de ...