阿里云日志服务Nginx监控耗时预警配置
5分钟时间窗口,上游服务response time大于1秒的数量 1*| SELECT time_series(__time__, '5m', '%Y-%m-%d %H:%i:%s' ,'0') as Time, count(1) as T where upstream_response_time > 1 group by Time order
5分钟时间窗口,上游服务response time大于1秒的数量 1*| SELECT time_series(__time__, '5m', '%Y-%m-%d %H:%i:%s' ,'0') as Time, count(1) as T where upstream_response_time > 1 group by Time order
配置Nginx 1vim /etc/nginx/nginx.conf Nginx新增一个日志格式 123log_format timed_combined '$remote_addr - $remote_user [$time_local] "$request" $http_host ' '$status $request_length $body_bytes_sent "$http_referer" ' '"$http_user_agent" $request_time $upstream_response_time "$sent_http_content_type"'; 设置日志输出路径 1access_log /var/log/nginx/aliyun.log timed_combined; 重新加载Nginx 1nginx -s reload