Build Cloud Logging metric filter configurations with label extractors and bucket options.
Build Cloud Logging metric filter configurations with label extractors, metric descriptors, and bucket options for custom metrics.
Required Fields
namefiltermetricDescriptor.metricKindmetricDescriptor.valueTypeOutput will appear here...Build a Cloud Logging user-defined metric, either a counter metric (metricKind DELTA, valueType INT64) that just counts matching log entries, or a distribution metric that also tracks a numeric value's spread via bucketOptions. labelExtractors pull values out of matched log entries using EXTRACT for a direct field reference or REGEXP_EXTRACT for pattern-based extraction, and each labeled dimension must also be declared in metricDescriptor.labels or the extractor is silently ignored at metric-creation time. Version V2 is the current schema; a metric declared under the older V1 semantics behaves differently around label cardinality limits.
A team builds a distribution metric intended to track error counts broken down by error_type, extracted via REGEXP_EXTRACT from a JSON payload field, and the metric shows the right total count in Cloud Monitoring but every single data point has an empty error_type label, making the per-category breakdown dashboard useless. Reviewing the metric definition shows error_type is used in labelExtractors but was never added to metricDescriptor.labels, so the extracted values have nowhere to attach. They use the builder to add the missing label declaration alongside the existing extractor, and after redeploying the metric definition, new log entries start populating the error_type breakdown correctly (existing historical data before the fix stays unlabeled).
A label declared in metricDescriptor.labels but never populated by any labelExtractor just shows up empty in every data point, which looks like a bug but is actually a metric definition that's half-wired, always pair every declared label with a matching extractor.
High-cardinality label values (like a raw user ID or a full unbounded error message string) can blow past per-metric time-series limits quickly, keeping a metric perpetually in a degraded or capped state, always extract a bounded, normalized category rather than raw high-cardinality text.
bucketOptions.exponentialBuckets parameters (numFiniteBuckets, growthFactor, scale) are set once at metric creation and aren't easy to retune without recreating the metric and losing bucket-comparable history, pick a bucket range that covers your actual expected value distribution up front.
The builder requires name, filter, metricDescriptor.metricKind, and metricDescriptor.valueType to resolve, the minimum fields the Logging API needs to define a metric and know whether it's a simple counter or a value-bearing distribution; labelExtractors and bucketOptions are validated as well-formed JSON but their internal consistency (every extractor label also declared, bucket ranges matching real data) is on you to verify.
Was this tool helpful?
Disclaimer: This tool runs entirely in your browser. No data is sent to our servers. Always verify outputs before using them in production. AWS, Azure, and GCP are trademarks of their respective owners.