Google Container Engine - How do I configure the amount of logs to keep?

4/27/2016

I am using Google Container Engine (GKE), how do I configure the amount of logs Stackdriver logging will retain (preferably: the number of days)?

-- aknuds1
google-kubernetes-engine
kubernetes
logging
stackdriver

1 Answer

4/27/2016

Stack driver logging agent sends the logs to the cloud logging. By default it keeps 30 days of log. You can extend it by exporting the logs to Google storage.

update

it is possible to export your logs to a Cloud Storage bucket, to a BigQuery dataset, or to a Google Cloud Pub/Sub. In those cases, logs entries are stored immediately and exported according to your configuration as follows:

  • Log entries are saved to Cloud Storage buckets in hourly batches, and it might take up to two hours before the entries begin to appear.
  • Log entries are streamed to BigQuery datasets and should appear right away, according to the BigQuery streaming data availability guidelines.
  • Log entries are streamed to Cloud Pub/Sub topics and should appear right away if there is a subscriber prepared to read them in a timely fashion

details on how to do it it can be read on https://cloud.google.com/logging/docs/export/using_exported_logs

Nearline cloud storage should cost you peanuts :)

-- nelasx
Source: StackOverflow