How to correlate and aggregate logs in Google App Engine Python 3?

25 views Asked by At

In order to get our App Engine application logs to correlate and aggregate all logs from a single request into one collapsed log entry in the Google Cloud Console Logs Explorer, seemingly we need to use the Google Cloud Logging libraries (which interestingly add over 15MB to the deployed app size).

There are half-baked docs and examples which point to each other but never really properly show how to do this:

https://cloud.google.com/appengine/migration-center/standard/python/migrate-to-cloud-logging

https://cloud.google.com/logging/docs/view/correlate-logs

https://cloud.google.com/logging/docs/setup/python

https://cloud.google.com/appengine/docs/standard/writing-application-logs?tab=python#related-app-logs

There seems to also be a potential bug that has been lingering for years:

https://issuetracker.google.com/issues/138365527

In some of the above resources, apparently you need to call logger.setup_client() to get the logs correlated, however there is never any example of what "logger" actually is.

There is a client.setup_logging() call which we are already using, however this seems to merely make the log severity visible in the logs, but does not correlate the logs.

Has anyone got this working?

0

There are 0 answers