0
votes

I'm using gcloud app logs tail to show recent logs from App Engine. However, I only get to see the request url and the response code. How can I get more tags or labels, like 'response size', and 'latency'?

This is what I can see online in Logs Viewer.

Online Log Viewer Screenshot

And this is what I get from the commend.

Command Line Screenshot

1

1 Answers

1
votes

It looks like you are trying to get the full request log data for App Engine Flex. This can be accomplished using the gcloud logging read command, which uses basic and advanced filters to return data from Cloud Logging.

To pull the full request logs, you might start with a command like this, and tune it to your purposes.

watch -n 1 "gcloud logging read 'resource.type=\"gae_app\" AND logName=\"projects/YOUR_PROJECT_ID/logs/appengine.googleapis.com%2Fnginx.request\"' --limit=10 --format=json --freshness=1s"

Note a few things about this example:

  • Use watch -n 1 to run the command every second, which is a workaround for the lack of tail. This is coupled with the --freshness=1s flag to get only fresh data each time.

  • Be sure to change "YOUR_PROJECT_ID" to your project ID.

  • Based on your screenshot, it appears you're trying to read the nginx.request logs from a Flex app; this example reflects that. If you want to read a different log type, you'll need to tune the log query in the command accordingly.

The documentation for configuring flags for gcloud logging read is here.

The documentation for composing basic and advanced filters is here.