Search code examples
google-cloud-platformmetricsgoogle-cloud-stackdriver

Is it possible to create an accumulated log-based metric in GCP/stackdriver?


I want to create a metric to accumulate over a full month. In other words, I want to count the occurrence of a certain entry in the logs over a calendar month to say at the end of the month "there were X events". Is this possible? I have seen such accumulated metrics in stackdriver (for example the bytes ingested by stackdriver logging by month) so I know they exist but I can't find how to create one using counters or distributions, which look like the only possible options for log-based metrics


Solution

  • Log-based counter metrics count the number of entries that match the filter every minute and do not aggregate over the month. Currently, the only way to accomplish this would be to use something like this to consume the LBM and re-write it as a cumulative custom metric.