【Azure 应用服务】更便捷的方式抓取Azure App Service for Windows的网络包
问题描述
在之前的一篇博文中,介绍了在App Service中抓取网络日志:
- 抓取Windows的网络包:【应用服务 App Service】App Service中抓取网络日志
- 抓取Linux的网络包:【Azure 应用服务】App Service For Linux 如何在 Web 应用实例上住抓取网络日志
现在,随着App Service的更新,Linnx也可以直接登录到SSH而不在需要复杂的配置操作。同时Windows环境中,也不在需要在本地安装 armclient.exe工具,而是直接通过 App Service的门户完成抓取,下载操作。
操作步骤
第一步: 进入App Service的Overview页面,点击“Diagnose and solve problems”, 然后再选择“ Diagnostic Tools” 方块
(注意: Diagnostic Tools路径变动,查看下图中的步骤)
第二步:选择 Collect Network Trace , 并设定抓取日志的时间长度, 60秒 ~ 15分钟的值供选择。页面中也对抓取网络日志的情况进行了说明:
Collect a Network Trace
If your app is facing issues while connecting to a remote server, you can use this tool to collect a network trace on the instance(s) serving the Web App.
Analyzing network traces is complex and time consuming task. Before collecting a network trace, please make sure you understand that you really need to collect a network trace to troubleshoot the problem.
What you should know before collecting a Network Trace
- 网络日志帮助定位TCP丢包,检查App Service与其他服务之间的HTTP通信情况(Network traces are helpful to troubleshoot TCP packet loss and to check HTTP communication that your App is making with the remote endpoints.)
- 在开始抓取网络日志后,要在App Service上重新我们需要抓包解决的问题(After the network trace is started, you should reproduce the problem so that outbound traffic from your App gets captured in the trace.)
- 如果适用HTTPS,那么数据将被加密(If the remote endpoints are called over TLS or SSL (i.e. HTTPS), then the traffic in the trace will be encrypted.)
- 将会收集应用所在的全部实例上的网络包(Network traces are collected on all the instance(s) serving your App.)
- 抓取网络日志只包含当前正在运行进程。当抓取网络包开始后,新的进程的网络包将不被抓取(Traces are captured only of processes that are running when the trace is started. The trace does not capture packets of any processes that start after the capture is started.)
- 可以适用Network Monitor和Wireshark工具对网络包进行分析(To analyze the Network Trace, you need tools like Network Monitor or Wireshark that can open the network captures.)
第三步:等待抓取时间完成,页面会直接显示网络包的下载地址。点击即可。
PS:此处不需要在登录到Kudu站点中,到 c:\home\logfiles\networktrace 目录中进行下载,但是如果要查看历史的网络抓包文件,还是需要到Kudu站点中下载。
注意:当前App Service For Linux环境,还是不支持以上方式抓包。 需要SSH,然后执行以下命令:
tcpdump -i any host <your app service inbound ip address> and tcp port 443 -n -v -s 0 -w /tmp/appnetworktrace.pcap
[END]
当在复杂的环境中面临问题,格物之道需:浊而静之徐清,安以动之徐生。 云中,恰是如此!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
2021-07-21 【Azure Developer】Azure REST API: 如何通过 API查看 Recovery Services Vaults(恢复保管库)的备份策略信息? 如备份中是否含有虚拟机的Disk