Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
253 views
in Technique[技术] by (71.8m points)

spring boot - GCP - creating a VM instance and extracting logs

I jave a JAVA application in which I am using GCP to create VM instances from images.

In this application, I would like to allow the user to view the vm creation logs in order to be updated on the status of the creation, and to be able to see failure points in detail.

I am sure such logs exist in GCP, but have been unable to find specific APIOs which let me see a specific action, for example creation of instance "X".

Thanks for the help

question from:https://stackoverflow.com/questions/65641075/gcp-creating-a-vm-instance-and-extracting-logs

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

When you create a VM, the answer that you have is a JobID (because the creation take time and the Compute Engine API answer immediately). To know the status of the VM start (and creation) you have to poll regularly this JobID.

In the logs, you can also filter with this JobID to select and view only the logs that you want on the Compute API side (create/start errors).

If you want to see the logs of the VM, filter the logs not with the JobID but with the name of the VM, and its zone.

In Java, you have client libraries that help you to achieve this


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...