I am using Google Container Engine (GKE), how do I configure the amount of logs Stackdriver logging will retain (preferably: the number of days)?
Asked
Active
Viewed 104 times
1 Answers
3
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
- 191
- 1
- 2
- 9
-
So there is no direct way of configuring the number of days to keep? How do you export the logs to Google Storage, concretely? – aknuds1 Apr 27 '16 at 18:13
-
i added a separate answer bellow, since it didn't fit in the comment box. – nelasx Apr 27 '16 at 18:29
-
You should add the instructions to your answer instead of linking to Google documentation, as linking to external resources in SO answers is considered bad etiquette (as links go bad). – aknuds1 Apr 27 '16 at 21:16