Elastalert 过滤日志级别并发送电子邮件

Elastalert filter on log levels and send an email

我在 elastalert 中有一些问题,这些问题真的让我卡住了。我正处于问题之中,因此非常需要您的帮助。我的问题如下:

我已经一个一个地尝试了,但是没有任何效果。

filter:
- term:
#      essage: "*INFO*"
#      query: "info"
#      host.name: "*IPADDRESS.us-east-2.compute.internal*"
以上的

None 有效。

你的问题有点宽泛,所以,我只能给出一些建议,但你可能想要 运行 像这样的东西:

# From rules/example_frequency.yaml
name: Immediate attention is necessary.
type: frequency
index: logstash-ming-ossec-syslog-new-*
num_events: 1
timeframe:
    minutes: 10

#- query:
#    query_string:
#       query: 'res:failed AND op:login  AND (NOT acct:root) AND (NOT acct:(unknown))'

#filter:
#- query:
#    query_string:
#      query: "system.log.severity: SEVERE

#or whatever makes sense with your data
filter:
- query:
    query_string:
      query: "alarm AND error AND (critical OR severe)"
      default_field: syslog_message


alert:
- "email"

email:
- "ming@log4analytics.com"
- "fgh@outlook.com"
smtp_host: "smtp.mailgun.org"
smtp_port: 25
smtp:ssl: true
from_addr: "ming@log4analytics.com"
smtp_auth_file: '/opt/elastalert/smtp_auth_file.yaml'

灵感来自 https://github.com/Yelp/elastalert/blob/master/example_rules/example_frequency.yaml