Google App Engine Logs

This page summarizes the logs available in Stackdriver Logging from App Engine. For more information about App Engine logging, see Using Cloud logging in App Engine apps.

Audit Logs

App Engine writes Admin Activity audit logs, cloudaudit.googleapis.com/activity, called activity in the Logs Viewer.

Standard environment logs

The App Engine standard environment produces the following logs:

  • Request logs, appengine.googleapis.com/request_log, called request_log in the Logs Viewer. This log records requests sent to all App Engine apps. The request log is provided by default and you cannot opt out of receiving it. For more details, see the RequestLog type.

  • Application logs consist of additional application information included in the request logs. The information is provided by default and you cannot opt out of receiving it. For more details, see the LogLine type.

  • Third party package logs. Some third-party package logs are also produced, including appengine.googleapis.com/nginx.request, called nginx.request in the Logs Viewer.

Log entries from App Engine use the resource type gae_app.

Request log field labels

For the App Engine standard environment request log, the following predefined names can be used as Logs Viewer field labels; see Field path identifiers for more information. All fields contain string values except for status and bytes.

Field name Contents
bytes The number of bytes in the response to the client. Example: 138.
method The HTTP method. Example: GET.
path The path appended to your host's address. Example: /service/local.
protocol The protocol used. Example: HTTP/1.1.
querystring The query string on the request, if any. Example: ?copies=3.
remotehost The host making the request. Example: 192.168.100.1.
request_id The RFC 1413 client ID.
status The numeric status code returned to the client: Example: 200.
user An authorized user, if any.
useragent The browser or other agent making the requests. Example: Stackdriver_terminus_bot.

App Engine flexible environment logs

The App Engine flexible environment produces the following logs:

  • Request logs record requests sent to all App Engine apps. The request log is provided by default and you cannot opt out of receiving it.

  • Application logs record activity by software within the App Engine app. The log is provided by default and you cannot opt out of receiving it.

  • Runtime logs are provided from the flexible environment using a preinstalled Stackdriver Logging agent. By changing the default configuration of the agent, you can opt in or opt out of specific logs. See Stackdriver Logging in App Engine Apps for more information.

  • Custom logs can be used with the flexible environment. By writing log files to a specific directory, your app can opt in to using these logs. See Stackdriver Logging in App Engine Apps for more information.

Logs from the flexible environment include resources of type gae_app.

Applications logs and request logs

Request and applications logs are stored separately in the flexible environment.

Log type Payload type Purpose
request text Requests made to your apps in the flexible environment.
app text or structured Application logs entries from your apps in the flexible environment.

Linking application logs and requests

In the App Engine flexible environment, application logs can be correlated with a particular request. Following are the requirements:

  1. The "parent" log entry must include a value for httpRequest.requestUrl.

  2. The "child" log entry must have a different log name than the parent. Typically, the child log entry is an application log entry in the app log, whereas the parent log entry is in the request log. The values for resource.type, resource.labels, and trace must be the same in the parent and its child(ren).

  3. The child log entry's timestamp must be within the time interval covered by the parent request. It must be earlier than parent.timestamp and later than parent.timestamp - parent.httpRequest.latency.

For more information on log entries, see the LogEntry data type in the Stackdriver Logging API.

Runtime logs

The App Engine flexible environment can write additional logs from the runtimes. See Stackdriver Logging in App Engine Apps for more information. Following are some of the logs that are configured by default:

Log name Purpose
activity Shows audit log information.
monitoring.* Information from the container where your app is running.
nginx.error Shows errors surfaced from within the nginx process.
nginx.health_check Shows nginx logs specifically for health checks. Reduces noise in the request logs.
nginx.request Shows logs from the nginx proxy as they are passed through to the app container.
shutdown.log Information logged on shutdown.
stdout Standard output from your app container.
stderr Standard error from your app container.
vm.events Operational events related to instances.
vm.shutdown Information logged on shutdown.
vm.syslog The VM syslog, outside of the app container.

VM events logging

You can gain insight into events related to your App Engine flexible environment instances using the vm.events stream in Logging. The following events are logged in this stream:

  • Instance creation
  • Instance termination (and why, reported on a best-effort basis)
  • Instance health check aggregate statistics reported approximately every minute
  • Instance unlocked for debugging or instance was accessed via SSH

Note that the vm.events stream may not report events in chronological order.

Shutdown logs

You can get diagnostic information when your app container is stopped. For example, this might happen if an app is unresponsive due to a deadlock or high load and has stopped returning requests, including health checks.

To help diagnose issues, you can get debug information, such as thread traces and heap statistics, from the app container through Stackdriver Logging (available in stdout and vm.shutdown streams).

In vm.shutdown, there are logs from Docker containers including the app container and other sidecar containers, such as nginx, for both healthy and unhealthy shutdown.

If your app is unhealthy, you can get other logs in vm.shutdown such as:

  • App stdout and stderr
  • Tail of app logs
  • Additional debug information: machine type, memory and disk usage, etc.

In the Java runtime, shutdown logging for the application container is built into the JVM. For more information, see the documentation.

In the Python runtime, faulthandler was added to the Python standard library in Python 3.3 and a backport is available for Python 2.7.

Custom logs

App Engine apps can write their own logs to a designated directory, in which case the logs will appear in Stackdriver Logging prefixed by the string custom.. See Stackdriver Logging in App Engine Apps for more information.

Log name Payload type Purpose
custom.* text or structured Custom logs from your apps.

Send feedback about...

Stackdriver Logging