Graylog: 警報通知
如何透過電郵、Slack 或 Mattermost 發送 Graylog 警報
👋 歡迎來到 Stackhero 文件!
Stackhero 提供即用型的 Graylog cloud 解決方案,帶來多項好處,包括:
- 包含無限和專用的 SMTP 電郵伺服器。
- 只需一鍵即可輕鬆更新。
- 使用 HTTPS 保護的可自訂域名(例如,https://logs.your-company.com)。
- 由專用私有 VM提供的最佳性能和強大安全性。
節省時間並簡化您的生活:只需 5 分鐘即可嘗試 Stackhero 的 Graylog cloud hosting 解決方案!
Graylog 讓您能夠主動回應特定情況,並透過通知發送警報。這些通知可以經由電郵、Slack、Mattermost 或 HTTP webhook 傳送。
如需進一步了解警報,請參閱 官方文件。
設定電郵通知
每個由 Stackhero 提供的 Graylog 實例都內建電郵伺服器,讓您可以直接從您的實例發送無限量電郵,無需額外收費。
如要設定電郵通知,您可以參考以下步驟:
-
登入您的 Graylog 服務,前往
Alerts>Notifications,然後點擊Get started!按鈕或選擇Create notification。 -
輸入通知標題,並於
Notification type選擇Email Notification。 -
在
Sender欄位輸入noreply@<yourGraylogDomain>。請記得將<yourGraylogDomain>替換為您實際的 Graylog 網域名稱,格式通常為<XXXXXX>.stackhero-network.com。重要提示: 請務必使用您的 Graylog 網域,以避免發送電郵時出現錯誤。
-
在
Email recipient欄位填寫您希望接收警報的電郵地址。
電郵設定範例 -
點擊
Execute test notification按鈕以確認一切運作正常。測試成功後,點擊Create完成設定。
恭喜您!您的電郵通知已成功建立並可正常運作!
處理錯誤:「Sending the email to the following server failed: postfix:25」
如果您遇到 Error: Notification has email recipients and is triggered, but sending emails failed. Sending the email to the following server failed: postfix:25 這個錯誤,通常是因為 sender 欄位格式不正確。正確格式應為 <something>@<yourGraylogDomain>。其中 "something" 可自訂(如 "noreply"),但 "yourGraylogDomain" 必須與您的 Graylog 服務網域一致,通常為 <XXXXXX>.stackhero-network.com。
設定 Slack 及 Mattermost 通知
如要設定 Slack 或 Mattermost Cloud 通知,您需先從 Slack 或 Mattermost Cloud 取得「incoming webhook」。
從 Slack 取得 incoming webhook URL
如使用 Slack,請前往 https://api.slack.com/apps 並點擊 Create New App。填寫表格並確認,然後選擇 Incoming Webhooks 並啟用。點擊 Add New Webhook to Workspace,複製 Webhook URL 以便後續使用。
從 Mattermost 取得 incoming webhook URL
如您偏好 Mattermost Cloud(Slack 的開源替代方案),請登入您的 Mattermost 介面。於主選單選擇 Integrations,然後選擇 Incoming Webhooks,點擊 Add Incoming Webhook 並完成表格。系統會提供一個格式為 https://<domain>/hooks/<token> 的 URL,請複製以便日後使用。
設定通知
在設定 Slack 及 Mattermost Cloud 通知前,請先於 Stackhero 控制台啟用 Integrations 插件。方法是選擇您的 Graylog 服務,點擊 Configure,啟用 Integrations 插件並確認設定。
完成後,請前往您的 Graylog 實例,進入 Alerts、Notifications,然後點擊 Get started! 或 Create notification。
輸入通知標題,並於 Notification type 選擇 Slack Notification。將您從 Slack 或 Mattermost 取得的 incoming webhook URL 貼到 Webhook URL 欄位。
Slack/Mattermost 設定範例
點擊 Execute Test Notification 按鈕以測試功能,確認無誤後點擊 Create 完成設定。
恭喜您,您的 Slack/Mattermost 通知現已設定完成並可即時使用!