Garylog日志告警配置方法
2019-08-22 本文已影响0人
我是孟小鱼呀
我们知道graylog可以将收集的的日志通过web界面展示出来,但随着日志量的增加,我们可能不能及时的发现一些异常日志。为了避免这中情况出现,告警通知可以说很有必要了。本篇文章就来告诉你如何设置graylog告警通知。
1、先在graylog server 的配置文件中添加Email配置
默认graylog的配置文件在/etc/graylog/server/server.conf
vim /etc/graylog/server/server.conf
#Email transport
transport_email_enabled = true
transport_email_hostname = smtp.exmail.qq.com
transport_email_port = 465
transport_email_use_auth = true
transport_email_auth_username = you@example.com#修改成自己的名字
transport_email_auth_password = secret#设置密码
transport_email_subject_prefix = [graylog]
transport_email_from_email = graylog@example.com#修改example
2、graylog web 界面配置



Condition type:
-
Field Content Alert Condition (字段内容)
Field表示字段,Value是字段的值,Grace Period是指当一个告警恢复时下一个告警的等待时间,Message Backlog是指包含在告警通知中的信息数量,Search Query(optional)查询搜索(可选的),可以匹配查询内容,默认是全部。例如下图告警条件是nginx日志中出现字段ERROR的内容。
4.jpg
-
Field Aggregation Alert Condition(字段聚合)
Threshold Type阈值类型,Aggregation Type聚合类型。可以根据自己的需求设置对应的参数。
5.jpg
-
Message Count Alert Condition(信息数量)
选择阈值类型,统计消息数量是否超过或者低于设定阈值,否则触发告警。
6.jpg condition配置完成
7.jpg


Notification type:
-
HTTP Alarm Callback
添加一条url到告警平台,告警平台可以通过配置发送到钉钉
10.jpg
-
Email Alert Callback
E-Mail Receivers选择接收邮件人的邮箱,Sender发生告警的发送方
11.jpg

