釘釘羣報警【c是符合條件的個數,st是響應狀態碼】html
阿里雲日誌服務儀表盤-5xx報警接口詳情前端
配置nginx日誌採集;nginx
/path_to_logs/**/access.log
/path_to_logs/([^/]+)/access.log
,正好把域名提取出來。可參考生成主題 參考文檔後端
5xx報警SQL服務器
__topic__:www.xyz.com and status in [500 600) | select count(1) as c, avg(status) as st, case when strpos(request_uri, '?') > 0 then split_part(request_uri, '?', 1) else request_uri end as uri group by uri having count(1)>=5 order by count(1) desc
分析SQL的寫法可參考函數
告警條件配置阿里雲
告警通知配置spa
上面的配置圖可能會變,這個產品一直在進化,18年12月的時候發現有一次大的改版。日誌
dashboard相關報警請求的詳細信息列表SQL:code
__topic__:www.xyz.com and status in [500 600) | select time_local, status, upstream_addr, __topic__ as vhost, case when strpos(request_uri, '?') > 0 then split_part(request_uri, '?', 1) else request_uri end as uri order by time_local desc
dashboard慢響應分析SQL:
__topic__:www.xyz.com and request_time > 0.3 | select count(1) as count, avg(request_time) as avg_request_time, min(__topic__) as vhost, case when strpos(request_uri, '?') > 0 then split_part(request_uri, '?', 1) else request_uri end as uri group by uri order by avg_request_time desc