Priyan
Priyan

Reputation: 35

Need help to bulk download logs from Google Cloud Platform - Cloud Logging

I am new to GCP. I want to download logs from GCP Cloud Logging. Currently I am using google-cloud-logging library in java and fetching all the logs page by page. But it is really slow because of the API calls. Is there a better way to download bulk logs from GCP Cloud Logging by applying filters.

I am currently using this library.

<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-logging</artifactId>
<version>1.101.2</version>

Thanks in advance.

Upvotes: 1

Views: 7737

Answers (1)

Kolban
Kolban

Reputation: 15266

One can download all the existing logs using the gcloud logging read command. This returns all (matched) log entries without any form of paging/pagination. We can read about this command in detail here:

https://cloud.google.com/sdk/gcloud/reference/logging/read

For future log entries, consider using a Logging sink to capture the desired log entries automatically. Destinations of a sink include Google Cloud Storage and BigQuery.

Upvotes: 4

Related Questions