https://www.graylog.org/blog/19-graylog-splunk-integration-is-now-here
說整合也不太像 說白了就是過濾一些重要的資料再往splunk丟
因為如果是使用splunk免費版本的話一天只有500MB可以用
先由graylog2過濾的話就可省下不少的空間
利用的就是stream這個功能
不過我目前並不打算把log再丟到splunk
而且打算利用stream過濾一些異常的訊息
當發生狀況時發mail通知管理者
首先要先把發信功能打開
在graylog.conf內找到下列几行並依不同狀況進行修改
transport_email_enabled = true
transport_email_hostname = 1.2.3.4
transport_email_port = 25
transport_email_use_auth = false
transport_email_use_tls = false
transport_email_use_ssl = false
transport_email_auth_username =
transport_email_auth_password =
transport_email_subject_prefix = [graylog]
transport_email_from_email =
transport_email_web_interface_url = http://12.34.56.78
改完後重啟
接下來在web介面上操作
在stream上新增一個stream
接下來才是重點就是要manage rules
假設我想要找認証成功的user
也就是在message裡要包含 authentication 和 success 二個關鍵字
在manage rules不能寫在一起 否則會找不到 必須要分開成二筆rule
Field使用的就是message
Type要使用contain 不建議使用 match 或其他 有時會找不到
value就使用關鍵字
分別建立完成後就會有二筆rule
視需求是要符合全部或單一符合
設定後一定要進行測試
測試的方法就是利用我們的關鍵字進行search
得到結果後展開點一下右上方的 test against stream 選取設定的stream
測試成功會出現如下圖的訊息

再來就要設定alert了
首先新增一個alert condition 選取 stream跟condition type
接著設定觸發的次數及相關情況及是否要重覆寄送
再來新增一個alert notification
接著設定要寄送的相關訊息
最後要enable stream
設定完成後可以先寄送一封test mail
接下來如果有觸發就會收到mail了
mail並不會有完整的message內容 只是進行通知
必須要進到管理介面看
沒有留言:
張貼留言