Reputation: 4344
I deployed a nodejs app on Google App engine following this tutorial https://github.com/GoogleCloudPlatform/appengine-nodejs-quickstart it was successful and now I want to check the logs of the nodejs server, like in development from the terminal console. The Vms are managed by google but even if I ssh to them I don't know where to look for the logs.
Upvotes: 5
Views: 3148
Reputation: 5058
As @tamberg mentioned in a comment, the easiest option I've found for looking at logs produced by Google App Engine instances running Node.js is to simply use the log viewer at:
https://console.cloud.google.com/logs/viewer?resource=gae_app
Detailed instructions from https://cloud.google.com/appengine/docs/standard/nodejs/building-app/viewing-service-logs are as follows:
Upvotes: 1
Reputation: 9431
The default logging is really awful. None of my console.log
messages show up! There are a few ways you can fix this.
For example, /var/log/app_engine/custom_logs/applogs.log
https://cloud.google.com/appengine/articles/logging
"Cloud Logging and Managed VMs apps Applications using App Engine Managed VMs should write custom log files to the VM's log directory at /var/log/app_engine/custom_logs. These files are automatically collected and made available in the Logs Viewer. Custom log files must have the suffix .log or .log.json. If the suffix is .log.json, the logs must be in JSON format with one JSON object per line. If the suffix is .log, log entries are treated as plain text."
Create a transport that will send the logs to appengine.
Too verbose for my liking, but it is another option.
Upvotes: 0
Reputation: 36
You can read the stdout of the docker container that your app runs by doing docker logs <container id>
in the VM instance. You can get the container id from docker ps
.
No need to SSH into the instance though. You can simply fetch the logs from the Developers Console under Monitoring > Logs
.
Upvotes: 2