当日志不包含错误消息时,如何对 Azure Linux 应用服务进行故障排除

How do I troubleshoot Azure Linux App Service when logs are not including error messages

我已经部署了一个 Azure Linux 应用服务,运行 是一个带有 LoopBack 4 框架的 NodeJS 应用程序已经有一段时间了,但是从上周左右开始,我在部署使用 Azure DevOps 的新版本应用程序。

上周部署应用程序时,应用程序需要重新启动几次才能启动。从昨天开始,应用程序可用大约需要 7 个小时,而今天(在撰写本文时)需要 3 个小时。

这目前仅在我的开发环境中(prod 将仅在 pull request 上部署),但我认为当我为此部署新版本时,我的生产环境也会发生同样的情况。很遗憾,我现在不能尝试这个。

当我打开日志流时,除此之外我没有看到任何错误 Waiting for response to warmup request for container

我不知道它是否与启动应用程序超时有关,因为我在“诊断和解决问题”屏幕中收到该错误消息,但是当我 运行 我的应用程序在我的开发机器上,启动时间不到 5 秒。

我尝试通过以下方式将 WEBSITES_CONTAINER_START_TIME_LIMIT 设置设置为 1800

但这并不是我想要的结果,因为我仍然看到 Waiting for response to warup request for container 消息。

在 Azure 门户的“诊断和解决问题”屏幕中,我还收到容器崩溃的错误消息。我希望我会看到某种关于失败原因的错误,但我看到的只是以下输出:

Container qusito-core-dev_0_fdc9a431 couldn't be started: Logs = 2020-09-11T13:43:59.410899652Z   _____                               
2020-09-11T13:43:59.410934153Z   /  _  \ __________ _________   ____  
2020-09-11T13:43:59.410938953Z  /  /_\  \___   /  |  \_  __ \_/ __ \ 
2020-09-11T13:43:59.410942753Z /    |    \/    /|  |  /|  | \/\  ___/ 
2020-09-11T13:43:59.410946453Z \____|__  /_____ \____/ |__|    \___  >
2020-09-11T13:43:59.410950153Z         \/      \/                  \/ 
2020-09-11T13:43:59.410953753Z A P P   S E R V I C E   O N   L I N U X
2020-09-11T13:43:59.410957153Z 
2020-09-11T13:43:59.410960353Z Documentation: http://aka.ms/webapp-linux
2020-09-11T13:43:59.410963553Z NodeJS quickstart: https://aka.ms/node-qs
2020-09-11T13:43:59.410966853Z NodeJS Version : v10.14.2
2020-09-11T13:43:59.410970153Z Note: Any data outside '/home' is not persisted
2020-09-11T13:43:59.410973453Z 
2020-09-11T13:44:00.211504840Z Cound not find build manifest file at '/home/site/wwwroot/oryx-manifest.toml'
2020-09-11T13:44:00.211887043Z Could not find operation ID in manifest. Generating an operation id...
2020-09-11T13:44:00.211897743Z Build Operation ID: 7cf16daf-ccef-4ad1-b496-50778dafc913
2020-09-11T13:44:02.114481171Z Writing output script to '/opt/startup/startup.sh'
2020-09-11T13:44:02.490713708Z Running #!/bin/sh
2020-09-11T13:44:02.491320612Z 
2020-09-11T13:44:02.491332412Z # Enter the source directory to make sure the script runs where the user expects
2020-09-11T13:44:02.491336512Z cd "/home/site/wwwroot"
2020-09-11T13:44:02.491340212Z 
2020-09-11T13:44:02.491344012Z export NODE_PATH=$(npm root --quiet -g):$NODE_PATH
2020-09-11T13:44:02.491347512Z if [ -z "$PORT" ]; then
2020-09-11T13:44:02.493136724Z      export PORT=8080
2020-09-11T13:44:02.493148924Z fi
2020-09-11T13:44:02.493152724Z 
2020-09-11T13:44:02.493341325Z PATH="$PATH:/home/site/wwwroot" npm run start
2020-09-11T13:44:06.600726640Z npm info it worked if it ends with ok
2020-09-11T13:44:06.600776740Z npm info using npm@6.9.0
2020-09-11T13:44:06.600875440Z npm info using node@v10.14.2
2020-09-11T13:44:06.868226973Z npm info lifecycle core@1.0.0~prestart: core@1.0.0
2020-09-11T13:44:06.885230583Z 
2020-09-11T13:44:06.885248883Z > core@1.0.0 prestart /home/site/wwwroot
2020-09-11T13:44:06.885253583Z > npm run build
2020-09-11T13:44:06.885264583Z 
2020-09-11T13:44:07.662776822Z npm info it worked if it ends with ok
2020-09-11T13:44:07.663855429Z npm info using npm@6.9.0
2020-09-11T13:44:07.664656534Z npm info using node@v10.14.2
2020-09-11T13:44:07.823510864Z npm info lifecycle core@1.0.0~prebuild: core@1.0.0
2020-09-11T13:44:07.824905373Z npm info lifecycle core@1.0.0~build: core@1.0.0
2020-09-11T13:44:07.835657242Z 
2020-09-11T13:44:07.835673743Z > core@1.0.0 build /home/site/wwwroot
2020-09-11T13:44:07.835678743Z > lb-tsc
2020-09-11T13:44:07.835682343Z 

此时我被这个问题困住了。我在 SO 的某处看到一个参考,日志流(在 Azure 门户中)不完全支持登录 Linux,但我不知道在哪里可以找到任何其他日志。 感谢任何关于我应该如何前进的帮助。

您可以通过 ConsoleKudu高级工具.

事实证明,我的设置中有一个拼写错误:WEBSITE_CONTAINER_START_TIME_LIMIT(忘记了 WEBSITE 后面的“S”)。

改完之后,我的部署没有任何问题。我还注意到 lb-tsc 命令在 运行 时大约需要 5-6 分钟。这可能是部署时出错的原因。