gpt4 book ai didi

elasticsearch - 使用 Kibana3 的警报/通知?

转载 作者:行者123 更新时间:2023-11-29 02:45:22 24 4
gpt4 key购买 nike

我正在使用 logstash-1.4.1elasticsearch-1.1.1kibana-3.1.0 来分析我的日志。我能够查看和查询我的日志。

当特定日志/事件发生时,需要警报/通知。例如:当登录失败日志一次又一次出现时,需要一个警报/通知(弹出、通过邮件等)。

目前我可以像查询失败登录一样查询我的日志,但我希望每当这样的日志出现时出现通知/弹出窗口而不是我手动查询它。

这可以使用以上三个来完成吗??如何实现?

最佳答案

您可以使用 Watcher 来监控您的 Elasticsearch。它通过邮件提醒您。

更多详情,请引用此链接:
https://www.elastic.co/products/watcher

您可以按照以下步骤配置 Watcher:

第 1 步 – 安装 Watcher 插件(适用于 1.7):

bin/plugin --install elasticsearch/watcher/latest
bin/plugin --install elasticsearch/license/latest

第 2 步 – 重启 Elasticsearch:

ES_HOME/bin/elasticsearch

第 3 步 – 验证观察者是否已设置:

curl -XGET 'http://localhost:9200/_watcher/stats?pretty'

第 4 步 – 查看日志数据是否有错误:

PUT /_watcher/watch/log_error_watch
{
"trigger": {
"schedule": {
"interval": "10m"
}
},
"input": {
"search": {
"request": {
"indices": ["logs"],
"body": {
"query": {
"match": {
"message": "error"
}
}
}
}
}
},
"condition": {
"compare": {
"ctx.payload.hits.total": {
"gt": 0
}
}
},
"actions": {
"send_email": {
"email": {
"to": "<username>@<domainname>",
"subject": "Cluster logs",
"body": "Cluster Error Logs ",
"attach_data": true
}
}
}
}

第 5 步 – 配置电子邮件(将以下行添加到 elasticsearch.yml):

watcher.actions.email.service.account:
work:
profile: gmail
email_defaults:
from: <email>
smtp:
auth: true
starttls.enable: true
host: smtp.gmail.com
port: 587
user: <username>
password: <password>

第 6 步 – 删除观察者:

curl -XDELETE'http://localhost:9200/_watcher/watch/log_error_watch'

关于elasticsearch - 使用 Kibana3 的警报/通知?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23948695/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com