4

Google Cloud Build allows us to store logs in either GCS or Cloud Logging or both or none. I just want to know what difference it makes when storing logs in GCS vs storing them in Cloud Logging. Maybe some of the things you can highlight are:

  • Advantages and disadvantages, or typical scenarios when I should use one over the other.
  • Difference in pricing, which may cost more than the other.
Harith
  • 539
  • 5
  • 16

3 Answers3

4

It's 2 different places with different features

Cloud Logging buckets allow you to

  • Store data during a different retention periods
  • Query the data from Cloud Logging (and soon via SQL expression)
  • Sink the logs from different projects in a single place (I wrote an article on that)
  • Use cloud monitoring/cloud alerting features

Cloud Storage sink allows you to

  • Store data during a different retention periods, with different storage class cost
  • Sink the logs from different projects in a single bucket
  • Move, copy, manage your files as you wish.
  • Ingest log file in third party tool (like splunk)

IMO, the main difference is the query capacity and the Cloud Monitoring and Alerting integration. Things that you loose when you store logs in Cloud Storage.

However, you gain file management with Cloud Storage.

guillaume blaquiere
  • 66,369
  • 2
  • 47
  • 76
2

The main difference is retention (aka how long we keep the logs before we remove them).

Default Build logs have some default retention periods (some are configurable some are not), you can read more in this doc.

If you store Build logs in GCS you have more flexibility in terms of how long you want to retain them.

Cost wise will depends on your build configs, the more logs your builds are generating, the more you will pay, this really depends on your specific builds config.

PjoterS
  • 12,841
  • 1
  • 22
  • 54
boredabdel
  • 1,732
  • 3
  • 7
1

It's quite a wide question and many factors depend on it. As @boredabdel mentioned, one of the differences is retention periods.

Another difference is that Google Cloud Storage has different costs when you are using Region/DualRegion/Multi-Region, StorageClass. It's good practice to check estimated costs using Google Cloud Pricing Calculator. You would also need to have proper Cloud Storage permissions. Depending if you will use the default Google-created Cloud Storage bucket you need Project Viewer role but for user-specified Cloud Storage bucket you need Storage Object Viewer role.

In Addition to GCS, you can also store build artifacts as it's mentioned in Storing build artifacts Documentation.

In short, it mainly depends on how long you want to keep those logs (mentioned by @boredabdel), which permission you have/might, how important those logs are (to use Cloud Logging or Cloud Storage).

PjoterS
  • 12,841
  • 1
  • 22
  • 54