Viewing output from startup scripts GCP Compute Engine

Read this post to understand the different ways to pass in a startup script to compute engine (using terraform)

To view metadata attributed set on the instance (e.g. foo=bar)

View the values of compute instance metadata
user@myinstance:~$ curl http://metadata/computeMetadata/v1/instance/attributes/foo -H "Metadata-Flavor: Google"
bar

Viewing startup script logs
Startup script output is written to the following log files:

  • CentOS and RHEL: /var/log/messages
  • Debian: /var/log/daemon.log
  • Ubuntu: /var/log/syslog
  • SLES: /var/log/messages

You can also use the journalctl command to view startup script output.

  • sudo journalctl -u google-startup-scripts.service

Next Steps?

Need help with your GCP efforts? Start the conversation today.  

anuj

I am passionate about getting cloud solutions right the first time. I help customers transition to the public cloud with the appropriate security controls and guardrails. GCP, AWS and Azure Security Specialist. <a href="https://calendly.com/anujvarma/google-cloud-architect-initial-consultation">Initial Consultation</a>

3 responses to “Viewing output from startup scripts GCP Compute Engine”

Leave a reply

Your email address will not be published. Required fields are marked *