Azure App Service日志流持续刷屏输出连接欢迎语无法查看日志
Azure Log Streams 重复刷屏欢迎提示问题处理
问题表现
Azure日志流功能以约每秒10次的频率持续输出Welcome, you are now connected to log-streaming service.提示,正常业务日志被完全覆盖,无法查看有效输出,异常样例如下:
2022-07-07T12:48:40 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:40 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:40 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:40 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:40 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:40 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:39 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:39 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:39 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:39 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:39 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:39 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:38 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:38 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:38 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:38 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:38 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:38 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:38 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:37 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:37 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:37 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:37 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:37 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:37 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:37 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:36 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:36 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:36 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:35 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:35 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:35 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:35 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:35 Welcome, you are now connected to log-streaming service. 2022-07-07T12:48:35 Welcome, you are now connected to log-streaming service.
触发原因
这是Azure App Service日志流的长连接重连bug,核心是日志流连接反复断开、重建,每次建连成功就会打印一次欢迎提示,高频触发的常见场景:
- 同一应用的日志流页面被多个浏览器标签页同时打开,或者有后台脚本、浏览器插件持续发起日志流连接请求,新连接不断抢占旧连接,触发循环重连
- 应用所在的App Service Plan负载过高,CPU、内存占用长期超过80%,日志流代理进程无法维持长连接,平台侧自动重连机制反复触发
修复方案
按以下顺序排查处理即可:
- 关闭所有打开了该应用日志流的浏览器标签页,清除对应站点的缓存和Cookie后,单独开一个新标签页打开日志流,排除多连接抢占问题
- 到Azure门户查看App Service Plan的资源监控指标,如果存在CPU、内存持续跑满的情况,先扩容实例规格、优化应用内存/CPU占用,等负载回落到正常区间后再使用日志流
- 前两步操作无效的话,直接重启对应应用实例,强制重置所有现存的日志流长连接会话即可恢复
- 紧急排障时可以绕过门户日志流页面,直接进入应用的Kudu管理站点,从
LogFiles目录下载原始日志文件查看,不受这个重连bug影响
临时过滤方案:如果需要立刻查看日志、来不及做上述修复,可以在日志流页面按F12打开浏览器控制台,执行以下JS脚本自动过滤掉重复的欢迎提示行,直接展示业务日志:
setInterval(() => { document.querySelectorAll('.log-line').forEach(line => { if (line.textContent.includes('Welcome, you are now connected to log-streaming service.')) line.remove() }) }, 100)
内容的提问来源于stack exchange,提问作者flutterisbae
相关产品推荐
相关产品推荐

