1嗤详、graylog server 添加 email 配置瓷炮,并重啟服務(wù)
# vim /etc/graylog/server/server.conf
transport_email_enabled = true
transport_email_hostname = mail.xxx.cn
transport_email_port = 587
transport_email_use_auth = true
transport_email_use_tls = false
transport_email_use_ssl = false
transport_email_auth_username = it_monitor
transport_email_auth_password = 123456
transport_email_subject_prefix = [graylog]
transport_email_from_email = it_monitor@xxx.cn
transport_email_web_interface_url = http://graylog.xxx.cn
# systemctl restart graylog-server
2娘香、在 graylog web 界面配置告警規(guī)則
示例:生產(chǎn)應(yīng)用服務(wù)只要出現(xiàn) OutOfMemoryError 關(guān)鍵字就告警
2.1 先配置告警條件
2.2 再配置告警通知
配置完告警通知后俐填,點(diǎn)擊 Test 測試一下郵件發(fā)送是否正常
測試成功的結(jié)果如下
模擬測試
// app.log 是 graylog-server 已經(jīng)監(jiān)聽收集的日志
echo "graylog alert test OutOfMemoryError" >> app.log
測試結(jié)果