google-cloud-platformgoogle-compute-enginespot-instances

Is gcp removed terminated vm logs?


Is GCP Vm logs are deleted after termination of vm?

I was running a GCE sopt vm with MIG(Managed Instance Group). My VM instance terminated. When i check logs of terminated Vm. I am not able to see logs of it.


Solution

  • You can check Audit log retention periods in this link.

    In my case I was still able to see the terminated spot VM logs in logging for the last 60 days.

    You can use the query below to view the logs of the terminated spot VM instance.

    Replace the PROJECT_ID with your project id:

    resource.type="gce_instance"
    projects/PROJECT_ID/logs/cloudaudit.googleapis.com%2Fsystem_event
    

    Then find the log entries with a similar line or statement below:

    system@google.com Instance was preempted.

    You can read this link for more information about "System Event audit logs"