Search code examples
google-app-enginegoogle-cloud-platformgoogle-cloud-logging

Google app engine Flexible env how to download the logs


I am trying to download my Google App Engine Flexible Environment Logs to my Local Machine. I saw this link downloading-logs for Standard env but I didn't find any relevant information about the Flexible env.

Can anyone please tell me how can I do that.


Solution

  • AFAIK it is not currently possible to download locally the logs from a flex environment GAE app in a similar manner as the one you referenced for a standard environment GAE app. Most likely because of the different format and the lack of an API for programatically reading them.

    From 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:

    And from Reading logs via API:

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

    One alternative I can think of would be to export your logs to Cloud Storage and download them from there (YMMV, I didn't actually do that). From 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.