Search code examples
google-cloud-platformgoogle-cloud-storagestackdrivergoogle-cloud-stackdriver

Google Stackdrive custom metrics - data retention period


I'm using GCP Stackdrive custom metrics and created few dashboard graphs to show the traffic on the system. The problem is that the graph system is keeping the data for few weeks - not forever.

From Stackdrive documentation:

See Quotas and limits for limits on the number of custom metrics and the number of active time series, and for the data retention period. If you wish to keep your metric data beyond the retention period, you must manually copy the data to another location, such as Cloud Storage or BigQuery.

Let's decide to work with Cloud Storage as a container to store data for the long term.

Questions:

  1. How does this "manual data copy" is working? Just write the same data into two places (Google storage and Stackdrive)?
  2. How the stackdrive is connecting the storage and generating graph of it?

Solution

  • You can use Stackdriver's Logs Export feature to export your logs into either of three sinks, Google Cloud Storage, BigQuery or Pub/Sub topic. Here are the instructions on how to export stackdriver logs. You are not writing logs in two places in real-time but exporting logs based on the filters you set.

    One thing to keep in mind is you will not be able to use stackdriver graphs or alerting tools with the exported logs.