GoogleCloudPlatform / compute-image-tools

Tools and scripts for Google Compute Engine images.
https://cloud.google.com/compute/docs/images
Apache License 2.0
203 stars 146 forks source link

Export log file from build/import VM #866

Open rofuentes opened 5 years ago

rofuentes commented 5 years ago

Add functionality to define 1 - many log files that will be copied to GCS bucket before failing or completing the workflow.

Windows tools such as Sysprep and DISM log to separate log files, and retrieving logs requires modifying the workflow to save the build/import disk. It would be more convenient to save logs containing the errors so that they can be investigated.

zoran15 commented 5 years ago

How should log files to be copied to GCS be specified?

Are file names fixed or they can have a variable part? What about paths?

Will the number of log files be variable or fixed (e.g. will logging of a single tool be spread of multiple files)?

dntczdx commented 5 years ago

It would be helpful to have a concrete example.

rofuentes commented 5 years ago

We run Sysprep at the end of an image build, that logs to C:\Windows\System32\Sysprep\Panther. If there is an error during Sysprep, this is documented in this txt log file. Nothing is sent to the serial console or to another centralized logging facility. The only way to determine what is happening is to RDP into the instance while it builds and view the log. This requires you to watch the build for ~3 hours and log in at the appropriate time.

I would like to be able to specify a log file location (absolute path) and have that file sent to a GCS bucket of my choice. This happens somewhat frequently, CBS is another example - Windows Update, uses at least 2 log files in different filepaths to record errors.

I can simply modify our PowerShell files to copy the files using gsutil, but I thought adding this functionality would be worthwhile.

Regarding the other questions: Log files are specified by absolute paths File names are fixed, no variables The number of log files is variable