简体   繁体   English

IBM Cloud Code Engine:当应用程序不活动时如何检查日志?

[英]IBM Cloud Code Engine: How to check logs when app not active?

I have deployed an app to IBM Cloud Code Engine.我已将应用程序部署到 IBM Cloud Code Engine。 It has the minimum instances configured to zero , so truly serverless and only active on demand.它的最小实例配置为零,因此真正无服务器且仅按需激活。 Now I wanted to check the logs from the CLI with现在我想检查来自 CLI 的日志

ibmcloud ce app logs --name myapp --all

it comes back with this message:它返回此消息:

FAILED No instances running for application 'myapp'. FAILED 没有为应用程序“myapp”运行的实例。 Verify that the application name is correct and it is running验证应用程序名称是否正确并且正在运行

How can I check the application logs after it has run?运行后如何检查应用程序日志?

The Code Engine application (and job) logs can be seen once Application Logging has been enabled .一旦启用了应用程序日志记录,就可以看到代码引擎应用程序(和作业)日志。 The logs are then available in a separate IBM Cloud Logging dashboard .然后可以在单独的IBM Cloud Logging 仪表板中使用这些日志。

I also found this old blog post exlaining how to enable CLI access to those logs .我还发现这篇旧博客文章解释了如何启用对这些日志的 CLI 访问 After enabling it I was able to retrieve the app logs using my CLI / development environment.启用它后,我可以使用我的 CLI / 开发环境检索应用程序日志。

在 CLI 上显示 JSON 日志记录

Depending on what I am after, I am using one of these three lines to get to the log data / lines:根据我所追求的,我使用这三行之一来获取日志数据/行:

python3 searchLogDNA.py myconfig.json 12 "search term" | jq

for pretty printing, or用于漂亮的打印,或

python3 searchLogDNA.py myconfig.json 12 "search term" | jq "._line"

to extract the actual log line from the record, or从记录中提取实际的日志行,或

python3 searchLogDNA.py myconfig.json 12 "search term" | jq "._line | fromjson`"

to turn the string with JSON data in the log line to actual JSON output.将日志行中带有 JSON 数据的字符串转换为实际的 JSON output。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 IBM Cloud:如何将 Db2 Warehouse 绑定到 Code Engine 应用程序? - IBM Cloud: How to bind Db2 Warehouse to Code Engine app? IBM Cloud Code Engine:如何从环境中确定应用程序 URL? - IBM Cloud Code Engine: How to determine app URL from environment? IBM Cloud Code Engine:如何在没有 CLI 的情况下从 GitLab 源部署应用程序 - IBM Cloud Code Engine: How can I deploy an app from GitLab source without CLI IBM Cloud:未使用时如何禁用分析引擎? - IBM Cloud: How to disable analytics engine when unused? 如何将 IBM cloudant 数据库连接到 IBM 云(云基础设施)上的 python 应用程序代码? - how to connect IBM cloudant database to python app code already on IBM cloud(cloud foundary)? 如何将自定义域添加到 IBM 云引擎 - How to add a custom domain to IBM cloud engine 使用端口 80 部署标准容器时,IBM Cloud Code Engine 修订失败 - IBM Cloud Code Engine revision fails when deploying standard container with port 80 IBM Cloud Code Engine:本地构建的容器镜像在部署时出现 exec 格式错误 - IBM Cloud Code Engine: Locally built container image gives exec format error when deployed IBM Cloud:如何控制由 Code Engine 构建引起的容器镜像数量? - IBM Cloud: How to control number of container images caused by Code Engine builds? 使用 Cloud Engine 时,在 IBM Cloud 中可访问作业的输出在哪里? - Where is the ouput of a Job accessible in IBM Cloud, when using Cloud Engine?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM