Google App Engine Flexible env 如何下载日志

Google app engine Flexible env how to download the logs

我正在尝试将我的 Google App Engine Flexible Environment Logs 下载到我的 Local Machine。我看到这个 link downloading-logs for Standard env 但我没有找到任何关于 Flexible env 的相关信息。

谁能告诉我该怎么做。

AFAIK 目前无法以与您为标准环境 GAE 应用程序引用的方式类似的方式从 flex 环境 GAE 应用程序本地下载日志。很可能是因为格式不同以及缺少用于以编程方式读取它们的 API。

来自Logging

Like the standard environment, logging works automatically in the flexible environment. However, the logs are collected in a different format. Logs will not be bundled by requests and logs from stdout and stderr are collected separately.

If you want more control over application logging, the ability to group logs, and the ability to log additional metadata, you can use the Stackdriver Logging API directly with the Google Cloud client libraries.

For more details, see the following guide:

并且来自 Reading logs via API

There is no API for reading App Engine logs created in the flexible environment.

我能想到的一种替代方法是将您的日志导出到云存储并从那里下载它们(YMMV,我实际上并没有这样做)。来自 Writing Application Logs:

The request and application logs for your app are collected by a Stackdriver Logging agent. See Quota Policy for the logs retention policy and for the maximum size of log entries. If you want to store your logs for a longer period, you can export your logs to Cloud Storage. You can also export your logs to BigQuery and Pub/Sub for further processing.