Startup script logs location
Asked Answered
U

4

34

In Google Cloud Platform's Ubuntu 16.04.1 instance, the output of my startup script was written to /var/log/startupscript.log.

Since they upgraded to 16.04.02 I can't find the logs anymore.

Any idea?

Undies answered 14/3, 2017 at 12:57 Comment(0)
A
36

The correct answer (by now) is to use journalctl:

sudo journalctl -u google-startup-scripts.service

You can re-run a startup script like this:

sudo google_metadata_script_runner --script-type startup

See also: https://cloud.google.com/compute/docs/instances/startup-scripts/linux

Apterygial answered 25/11, 2021 at 17:6 Comment(2)
I had to pass the argument google_metadata_script_runner --script-type startupExstipulate
It seems they updated. I will edit the answer so it stays valid.Apterygial
C
33

UPDATE from the official documentation:

Startup script output is written to the following log files:

  • CentOS and RHEL: /var/log/messages

  • Debian: /var/log/daemon.log

  • Ubuntu 14.04, 16.04, and 16.10: /var/log/syslog
  • SLES 11 and 12: /var/log/messages
Cocks answered 1/2, 2018 at 12:50 Comment(4)
do you know how to send these logs to Google Cloud Logging?Orji
I have never tried it, but for sure you can configuring the stackdriver agent cloud.google.com/logging/docs/agent/configurationCocks
cloud.google.com/logging/docs/agent/…Cocks
Thanks, that worked, I just had to add curl -sSO https://dl.google.com/cloudagents/install-logging-agent.sh sudo bash install-logging-agent.sh to the top of the start up script.Orji
I
0

To rerun your startup script, run below command

sudo google_metadata_script_runner startup

To view output of startup script

sudo journalctl -u google-startup-scripts.service
Interrelated answered 29/2, 2024 at 11:37 Comment(0)
K
-1

There are two ways to search for the log file probably a lot more but i know the below.

  1. locate -i startupscript.log - you may need to update your indexes periodically for this option to be optimal.
  2. From root find / -iname startupscript.log -print .
Kinata answered 14/3, 2017 at 13:4 Comment(2)
I actually tried this, but there is no script with that name anymore and I have checked all files showing up through find / -iname *.log -printUndies
I read this post about some users missing their /var/log/journal directory after they upgraded which is where their boot log information should be going. Granted they didnt state that they were on a Google Cloud platform so it could be different. Link to Ask Ubuntu Form postKinata

© 2022 - 2025 — McMap. All rights reserved.