8 Answers
Nope, the script does not need to be edited at all.
It’s helpful to check logs on your VM, what exactly was happened. The possible reason could be access permissions.
Still for me also same, nothing got reflecting in bucket after creating VM with given script
The instance you create is very small so it takes time to process the whole script and get to the part where it copies the log to the bucket. I had to wait about 10 minutes before it appeared. If you want to make sure things are going smothly, you can log into the instance and check for the running commands.
Yeah, using a micro instance as per the instructions can make it seem like things are unresponsive. I am just going to trust that as long as the logs are only outputting INFO messages, that things are still running.
The output of the startup script can be monitored with the folowing command:
sudo journalctl -u google-startup-scripts.service
even i am facing the same error,instance is running but the file is not created in cloud storage.I have tried running the above command as
i tried to the run your command ,i am getting message "No journal files were found.".Could you please suggest
stack driver logging option is not visible under logs, in compute engine section Logs: Cloud Logging Serial port 1 (console) Serial port 2 Serial port 3 Serial port 4 Here are the options whihc are available,Could you please suggest
I am having the same issue with my instances – stack driver logging option is not an option under logs, in compute engine section Logs: Cloud Logging Serial port 1 (console) Serial port 2 Serial port 3 Serial port 4 Here are the options are available. Does anyone have any suggestions?
Even I am having the same issue with my instances – stack driver logging option is not an option under logs. Is there any solution for this?
So I think that it is now just called Cloud Logging. If you click on that link it takes you to the logging page. Mine took about 30 mins as was "stuck" on "startup-script: Processing triggers for man-db (2.8.5-2) …" for about 10 mins alone. Once that was done it then continued with the rest of the script and worked fine.
In the script provided by the instructor replace: curl -sSO https://dl.google.com/cloudagents/install-logging-agent.sh bash install-logging-agent.sh with: curl -sSO https://dl.google.com/cloudagents/add-logging-agent-repo.sh bash add-logging-agent-repo.sh –also-install ====== See the docs here for more info about the change https://cloud.google.com/logging/docs/agent/installation as google may update their services.
It can be really useful to view the serial port output for the instance to see what exactly is going on. For example, if the scopes aren’t set up correctly or the service account doesn’t have sufficient access, then the StackDriver agent will install and run successfully but then the gsutil command will throw a 403 error.
To enable serial port access, you’ll have to set the metadata at either the project or instance level – the docs detail both commands.
https://cloud.google.com/compute/docs/troubleshooting/troubleshooting-using-serial-console.
You can view the serial port output from the console by selecting the instance and then clicking the Connect to Serial Console button or the "Serial port 1" link under logs; you can also view the output by running "gcloud compute instances get-serial-port-output my-instance". The response will return a pagination token, so that you can just pull fresh items. I’d recommend connecting to the console via the button for this – it opens in a separate window and streams the console output as it’s generated, which allows you to watch the script execute.
Note that the startup script doesn’t provide the gs:// prefix on the gsutil cp command. gs:// should be part of the metadata for the bucket.
In the script provided by the instructor replace:
curl -sSO https://dl.google.com/cloudagents/install-logging-agent.sh
bash install-logging-agent.sh
with:
curl -sSO https://dl.google.com/cloudagents/add-logging-agent-repo.sh
bash add-logging-agent-repo.sh –also-install
======
See the docs here for more info about the change https://cloud.google.com/logging/docs/agent/installation as google may update their services.
It may take few min for the logs to appear in the bucket if there is no error, You can track instance logs in
Logs Explorer
, It will give better idea on what’s going on