gcp.logging.Metric
Explore with Pulumi AI
Logs-based metric can also be used to extract values from logs and create a a distribution of the values. The distribution records the statistics of the extracted values along with an optional histogram of the values as specified by the bucket options.
To get more information about Metric, see:
- API documentation
- How-to Guides
Example Usage
Logging Metric Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const loggingMetric = new gcp.logging.Metric("logging_metric", {
name: "my-(custom)/metric",
filter: "resource.type=gae_app AND severity>=ERROR",
metricDescriptor: {
metricKind: "DELTA",
valueType: "DISTRIBUTION",
unit: "1",
labels: [
{
key: "mass",
valueType: "STRING",
description: "amount of matter",
},
{
key: "sku",
valueType: "INT64",
description: "Identifying number for item",
},
],
displayName: "My metric",
},
valueExtractor: "EXTRACT(jsonPayload.request)",
labelExtractors: {
mass: "EXTRACT(jsonPayload.request)",
sku: "EXTRACT(jsonPayload.id)",
},
bucketOptions: {
linearBuckets: {
numFiniteBuckets: 3,
width: 1,
offset: 1,
},
},
});
import pulumi
import pulumi_gcp as gcp
logging_metric = gcp.logging.Metric("logging_metric",
name="my-(custom)/metric",
filter="resource.type=gae_app AND severity>=ERROR",
metric_descriptor={
"metric_kind": "DELTA",
"value_type": "DISTRIBUTION",
"unit": "1",
"labels": [
{
"key": "mass",
"value_type": "STRING",
"description": "amount of matter",
},
{
"key": "sku",
"value_type": "INT64",
"description": "Identifying number for item",
},
],
"display_name": "My metric",
},
value_extractor="EXTRACT(jsonPayload.request)",
label_extractors={
"mass": "EXTRACT(jsonPayload.request)",
"sku": "EXTRACT(jsonPayload.id)",
},
bucket_options={
"linear_buckets": {
"num_finite_buckets": 3,
"width": 1,
"offset": 1,
},
})
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/logging"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := logging.NewMetric(ctx, "logging_metric", &logging.MetricArgs{
Name: pulumi.String("my-(custom)/metric"),
Filter: pulumi.String("resource.type=gae_app AND severity>=ERROR"),
MetricDescriptor: &logging.MetricMetricDescriptorArgs{
MetricKind: pulumi.String("DELTA"),
ValueType: pulumi.String("DISTRIBUTION"),
Unit: pulumi.String("1"),
Labels: logging.MetricMetricDescriptorLabelArray{
&logging.MetricMetricDescriptorLabelArgs{
Key: pulumi.String("mass"),
ValueType: pulumi.String("STRING"),
Description: pulumi.String("amount of matter"),
},
&logging.MetricMetricDescriptorLabelArgs{
Key: pulumi.String("sku"),
ValueType: pulumi.String("INT64"),
Description: pulumi.String("Identifying number for item"),
},
},
DisplayName: pulumi.String("My metric"),
},
ValueExtractor: pulumi.String("EXTRACT(jsonPayload.request)"),
LabelExtractors: pulumi.StringMap{
"mass": pulumi.String("EXTRACT(jsonPayload.request)"),
"sku": pulumi.String("EXTRACT(jsonPayload.id)"),
},
BucketOptions: &logging.MetricBucketOptionsArgs{
LinearBuckets: &logging.MetricBucketOptionsLinearBucketsArgs{
NumFiniteBuckets: pulumi.Int(3),
Width: pulumi.Float64(1),
Offset: pulumi.Float64(1),
},
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var loggingMetric = new Gcp.Logging.Metric("logging_metric", new()
{
Name = "my-(custom)/metric",
Filter = "resource.type=gae_app AND severity>=ERROR",
MetricDescriptor = new Gcp.Logging.Inputs.MetricMetricDescriptorArgs
{
MetricKind = "DELTA",
ValueType = "DISTRIBUTION",
Unit = "1",
Labels = new[]
{
new Gcp.Logging.Inputs.MetricMetricDescriptorLabelArgs
{
Key = "mass",
ValueType = "STRING",
Description = "amount of matter",
},
new Gcp.Logging.Inputs.MetricMetricDescriptorLabelArgs
{
Key = "sku",
ValueType = "INT64",
Description = "Identifying number for item",
},
},
DisplayName = "My metric",
},
ValueExtractor = "EXTRACT(jsonPayload.request)",
LabelExtractors =
{
{ "mass", "EXTRACT(jsonPayload.request)" },
{ "sku", "EXTRACT(jsonPayload.id)" },
},
BucketOptions = new Gcp.Logging.Inputs.MetricBucketOptionsArgs
{
LinearBuckets = new Gcp.Logging.Inputs.MetricBucketOptionsLinearBucketsArgs
{
NumFiniteBuckets = 3,
Width = 1,
Offset = 1,
},
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.logging.Metric;
import com.pulumi.gcp.logging.MetricArgs;
import com.pulumi.gcp.logging.inputs.MetricMetricDescriptorArgs;
import com.pulumi.gcp.logging.inputs.MetricBucketOptionsArgs;
import com.pulumi.gcp.logging.inputs.MetricBucketOptionsLinearBucketsArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var loggingMetric = new Metric("loggingMetric", MetricArgs.builder()
.name("my-(custom)/metric")
.filter("resource.type=gae_app AND severity>=ERROR")
.metricDescriptor(MetricMetricDescriptorArgs.builder()
.metricKind("DELTA")
.valueType("DISTRIBUTION")
.unit("1")
.labels(
MetricMetricDescriptorLabelArgs.builder()
.key("mass")
.valueType("STRING")
.description("amount of matter")
.build(),
MetricMetricDescriptorLabelArgs.builder()
.key("sku")
.valueType("INT64")
.description("Identifying number for item")
.build())
.displayName("My metric")
.build())
.valueExtractor("EXTRACT(jsonPayload.request)")
.labelExtractors(Map.ofEntries(
Map.entry("mass", "EXTRACT(jsonPayload.request)"),
Map.entry("sku", "EXTRACT(jsonPayload.id)")
))
.bucketOptions(MetricBucketOptionsArgs.builder()
.linearBuckets(MetricBucketOptionsLinearBucketsArgs.builder()
.numFiniteBuckets(3)
.width(1)
.offset(1)
.build())
.build())
.build());
}
}
resources:
loggingMetric:
type: gcp:logging:Metric
name: logging_metric
properties:
name: my-(custom)/metric
filter: resource.type=gae_app AND severity>=ERROR
metricDescriptor:
metricKind: DELTA
valueType: DISTRIBUTION
unit: '1'
labels:
- key: mass
valueType: STRING
description: amount of matter
- key: sku
valueType: INT64
description: Identifying number for item
displayName: My metric
valueExtractor: EXTRACT(jsonPayload.request)
labelExtractors:
mass: EXTRACT(jsonPayload.request)
sku: EXTRACT(jsonPayload.id)
bucketOptions:
linearBuckets:
numFiniteBuckets: 3
width: 1
offset: 1
Logging Metric Counter Basic
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const loggingMetric = new gcp.logging.Metric("logging_metric", {
name: "my-(custom)/metric",
filter: "resource.type=gae_app AND severity>=ERROR",
metricDescriptor: {
metricKind: "DELTA",
valueType: "INT64",
},
});
import pulumi
import pulumi_gcp as gcp
logging_metric = gcp.logging.Metric("logging_metric",
name="my-(custom)/metric",
filter="resource.type=gae_app AND severity>=ERROR",
metric_descriptor={
"metric_kind": "DELTA",
"value_type": "INT64",
})
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/logging"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := logging.NewMetric(ctx, "logging_metric", &logging.MetricArgs{
Name: pulumi.String("my-(custom)/metric"),
Filter: pulumi.String("resource.type=gae_app AND severity>=ERROR"),
MetricDescriptor: &logging.MetricMetricDescriptorArgs{
MetricKind: pulumi.String("DELTA"),
ValueType: pulumi.String("INT64"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var loggingMetric = new Gcp.Logging.Metric("logging_metric", new()
{
Name = "my-(custom)/metric",
Filter = "resource.type=gae_app AND severity>=ERROR",
MetricDescriptor = new Gcp.Logging.Inputs.MetricMetricDescriptorArgs
{
MetricKind = "DELTA",
ValueType = "INT64",
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.logging.Metric;
import com.pulumi.gcp.logging.MetricArgs;
import com.pulumi.gcp.logging.inputs.MetricMetricDescriptorArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var loggingMetric = new Metric("loggingMetric", MetricArgs.builder()
.name("my-(custom)/metric")
.filter("resource.type=gae_app AND severity>=ERROR")
.metricDescriptor(MetricMetricDescriptorArgs.builder()
.metricKind("DELTA")
.valueType("INT64")
.build())
.build());
}
}
resources:
loggingMetric:
type: gcp:logging:Metric
name: logging_metric
properties:
name: my-(custom)/metric
filter: resource.type=gae_app AND severity>=ERROR
metricDescriptor:
metricKind: DELTA
valueType: INT64
Logging Metric Counter Labels
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const loggingMetric = new gcp.logging.Metric("logging_metric", {
name: "my-(custom)/metric",
filter: "resource.type=gae_app AND severity>=ERROR",
metricDescriptor: {
metricKind: "DELTA",
valueType: "INT64",
labels: [{
key: "mass",
valueType: "STRING",
description: "amount of matter",
}],
},
labelExtractors: {
mass: "EXTRACT(jsonPayload.request)",
},
});
import pulumi
import pulumi_gcp as gcp
logging_metric = gcp.logging.Metric("logging_metric",
name="my-(custom)/metric",
filter="resource.type=gae_app AND severity>=ERROR",
metric_descriptor={
"metric_kind": "DELTA",
"value_type": "INT64",
"labels": [{
"key": "mass",
"value_type": "STRING",
"description": "amount of matter",
}],
},
label_extractors={
"mass": "EXTRACT(jsonPayload.request)",
})
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/logging"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := logging.NewMetric(ctx, "logging_metric", &logging.MetricArgs{
Name: pulumi.String("my-(custom)/metric"),
Filter: pulumi.String("resource.type=gae_app AND severity>=ERROR"),
MetricDescriptor: &logging.MetricMetricDescriptorArgs{
MetricKind: pulumi.String("DELTA"),
ValueType: pulumi.String("INT64"),
Labels: logging.MetricMetricDescriptorLabelArray{
&logging.MetricMetricDescriptorLabelArgs{
Key: pulumi.String("mass"),
ValueType: pulumi.String("STRING"),
Description: pulumi.String("amount of matter"),
},
},
},
LabelExtractors: pulumi.StringMap{
"mass": pulumi.String("EXTRACT(jsonPayload.request)"),
},
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var loggingMetric = new Gcp.Logging.Metric("logging_metric", new()
{
Name = "my-(custom)/metric",
Filter = "resource.type=gae_app AND severity>=ERROR",
MetricDescriptor = new Gcp.Logging.Inputs.MetricMetricDescriptorArgs
{
MetricKind = "DELTA",
ValueType = "INT64",
Labels = new[]
{
new Gcp.Logging.Inputs.MetricMetricDescriptorLabelArgs
{
Key = "mass",
ValueType = "STRING",
Description = "amount of matter",
},
},
},
LabelExtractors =
{
{ "mass", "EXTRACT(jsonPayload.request)" },
},
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.logging.Metric;
import com.pulumi.gcp.logging.MetricArgs;
import com.pulumi.gcp.logging.inputs.MetricMetricDescriptorArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var loggingMetric = new Metric("loggingMetric", MetricArgs.builder()
.name("my-(custom)/metric")
.filter("resource.type=gae_app AND severity>=ERROR")
.metricDescriptor(MetricMetricDescriptorArgs.builder()
.metricKind("DELTA")
.valueType("INT64")
.labels(MetricMetricDescriptorLabelArgs.builder()
.key("mass")
.valueType("STRING")
.description("amount of matter")
.build())
.build())
.labelExtractors(Map.of("mass", "EXTRACT(jsonPayload.request)"))
.build());
}
}
resources:
loggingMetric:
type: gcp:logging:Metric
name: logging_metric
properties:
name: my-(custom)/metric
filter: resource.type=gae_app AND severity>=ERROR
metricDescriptor:
metricKind: DELTA
valueType: INT64
labels:
- key: mass
valueType: STRING
description: amount of matter
labelExtractors:
mass: EXTRACT(jsonPayload.request)
Logging Metric Logging Bucket
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const loggingMetric = new gcp.logging.ProjectBucketConfig("logging_metric", {
location: "global",
project: "my-project-name",
bucketId: "_Default",
});
const loggingMetricMetric = new gcp.logging.Metric("logging_metric", {
name: "my-(custom)/metric",
filter: "resource.type=gae_app AND severity>=ERROR",
bucketName: loggingMetric.id,
});
import pulumi
import pulumi_gcp as gcp
logging_metric = gcp.logging.ProjectBucketConfig("logging_metric",
location="global",
project="my-project-name",
bucket_id="_Default")
logging_metric_metric = gcp.logging.Metric("logging_metric",
name="my-(custom)/metric",
filter="resource.type=gae_app AND severity>=ERROR",
bucket_name=logging_metric.id)
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/logging"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
loggingMetric, err := logging.NewProjectBucketConfig(ctx, "logging_metric", &logging.ProjectBucketConfigArgs{
Location: pulumi.String("global"),
Project: pulumi.String("my-project-name"),
BucketId: pulumi.String("_Default"),
})
if err != nil {
return err
}
_, err = logging.NewMetric(ctx, "logging_metric", &logging.MetricArgs{
Name: pulumi.String("my-(custom)/metric"),
Filter: pulumi.String("resource.type=gae_app AND severity>=ERROR"),
BucketName: loggingMetric.ID(),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var loggingMetric = new Gcp.Logging.ProjectBucketConfig("logging_metric", new()
{
Location = "global",
Project = "my-project-name",
BucketId = "_Default",
});
var loggingMetricMetric = new Gcp.Logging.Metric("logging_metric", new()
{
Name = "my-(custom)/metric",
Filter = "resource.type=gae_app AND severity>=ERROR",
BucketName = loggingMetric.Id,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.logging.ProjectBucketConfig;
import com.pulumi.gcp.logging.ProjectBucketConfigArgs;
import com.pulumi.gcp.logging.Metric;
import com.pulumi.gcp.logging.MetricArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var loggingMetric = new ProjectBucketConfig("loggingMetric", ProjectBucketConfigArgs.builder()
.location("global")
.project("my-project-name")
.bucketId("_Default")
.build());
var loggingMetricMetric = new Metric("loggingMetricMetric", MetricArgs.builder()
.name("my-(custom)/metric")
.filter("resource.type=gae_app AND severity>=ERROR")
.bucketName(loggingMetric.id())
.build());
}
}
resources:
loggingMetric:
type: gcp:logging:ProjectBucketConfig
name: logging_metric
properties:
location: global
project: my-project-name
bucketId: _Default
loggingMetricMetric:
type: gcp:logging:Metric
name: logging_metric
properties:
name: my-(custom)/metric
filter: resource.type=gae_app AND severity>=ERROR
bucketName: ${loggingMetric.id}
Logging Metric Disabled
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
const loggingMetric = new gcp.logging.Metric("logging_metric", {
name: "my-(custom)/metric",
filter: "resource.type=gae_app AND severity>=ERROR",
metricDescriptor: {
metricKind: "DELTA",
valueType: "INT64",
},
disabled: true,
});
import pulumi
import pulumi_gcp as gcp
logging_metric = gcp.logging.Metric("logging_metric",
name="my-(custom)/metric",
filter="resource.type=gae_app AND severity>=ERROR",
metric_descriptor={
"metric_kind": "DELTA",
"value_type": "INT64",
},
disabled=True)
package main
import (
"github.com/pulumi/pulumi-gcp/sdk/v8/go/gcp/logging"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := logging.NewMetric(ctx, "logging_metric", &logging.MetricArgs{
Name: pulumi.String("my-(custom)/metric"),
Filter: pulumi.String("resource.type=gae_app AND severity>=ERROR"),
MetricDescriptor: &logging.MetricMetricDescriptorArgs{
MetricKind: pulumi.String("DELTA"),
ValueType: pulumi.String("INT64"),
},
Disabled: pulumi.Bool(true),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Gcp = Pulumi.Gcp;
return await Deployment.RunAsync(() =>
{
var loggingMetric = new Gcp.Logging.Metric("logging_metric", new()
{
Name = "my-(custom)/metric",
Filter = "resource.type=gae_app AND severity>=ERROR",
MetricDescriptor = new Gcp.Logging.Inputs.MetricMetricDescriptorArgs
{
MetricKind = "DELTA",
ValueType = "INT64",
},
Disabled = true,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gcp.logging.Metric;
import com.pulumi.gcp.logging.MetricArgs;
import com.pulumi.gcp.logging.inputs.MetricMetricDescriptorArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var loggingMetric = new Metric("loggingMetric", MetricArgs.builder()
.name("my-(custom)/metric")
.filter("resource.type=gae_app AND severity>=ERROR")
.metricDescriptor(MetricMetricDescriptorArgs.builder()
.metricKind("DELTA")
.valueType("INT64")
.build())
.disabled(true)
.build());
}
}
resources:
loggingMetric:
type: gcp:logging:Metric
name: logging_metric
properties:
name: my-(custom)/metric
filter: resource.type=gae_app AND severity>=ERROR
metricDescriptor:
metricKind: DELTA
valueType: INT64
disabled: true
Create Metric Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Metric(name: string, args: MetricArgs, opts?: CustomResourceOptions);
@overload
def Metric(resource_name: str,
args: MetricArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Metric(resource_name: str,
opts: Optional[ResourceOptions] = None,
filter: Optional[str] = None,
bucket_name: Optional[str] = None,
bucket_options: Optional[MetricBucketOptionsArgs] = None,
description: Optional[str] = None,
disabled: Optional[bool] = None,
label_extractors: Optional[Mapping[str, str]] = None,
metric_descriptor: Optional[MetricMetricDescriptorArgs] = None,
name: Optional[str] = None,
project: Optional[str] = None,
value_extractor: Optional[str] = None)
func NewMetric(ctx *Context, name string, args MetricArgs, opts ...ResourceOption) (*Metric, error)
public Metric(string name, MetricArgs args, CustomResourceOptions? opts = null)
public Metric(String name, MetricArgs args)
public Metric(String name, MetricArgs args, CustomResourceOptions options)
type: gcp:logging:Metric
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args MetricArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args MetricArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args MetricArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args MetricArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args MetricArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var metricResource = new Gcp.Logging.Metric("metricResource", new()
{
Filter = "string",
BucketName = "string",
BucketOptions = new Gcp.Logging.Inputs.MetricBucketOptionsArgs
{
ExplicitBuckets = new Gcp.Logging.Inputs.MetricBucketOptionsExplicitBucketsArgs
{
Bounds = new[]
{
0,
},
},
ExponentialBuckets = new Gcp.Logging.Inputs.MetricBucketOptionsExponentialBucketsArgs
{
GrowthFactor = 0,
NumFiniteBuckets = 0,
Scale = 0,
},
LinearBuckets = new Gcp.Logging.Inputs.MetricBucketOptionsLinearBucketsArgs
{
NumFiniteBuckets = 0,
Offset = 0,
Width = 0,
},
},
Description = "string",
Disabled = false,
LabelExtractors =
{
{ "string", "string" },
},
MetricDescriptor = new Gcp.Logging.Inputs.MetricMetricDescriptorArgs
{
MetricKind = "string",
ValueType = "string",
DisplayName = "string",
Labels = new[]
{
new Gcp.Logging.Inputs.MetricMetricDescriptorLabelArgs
{
Key = "string",
Description = "string",
ValueType = "string",
},
},
Unit = "string",
},
Name = "string",
Project = "string",
ValueExtractor = "string",
});
example, err := logging.NewMetric(ctx, "metricResource", &logging.MetricArgs{
Filter: pulumi.String("string"),
BucketName: pulumi.String("string"),
BucketOptions: &logging.MetricBucketOptionsArgs{
ExplicitBuckets: &logging.MetricBucketOptionsExplicitBucketsArgs{
Bounds: pulumi.Float64Array{
pulumi.Float64(0),
},
},
ExponentialBuckets: &logging.MetricBucketOptionsExponentialBucketsArgs{
GrowthFactor: pulumi.Float64(0),
NumFiniteBuckets: pulumi.Int(0),
Scale: pulumi.Float64(0),
},
LinearBuckets: &logging.MetricBucketOptionsLinearBucketsArgs{
NumFiniteBuckets: pulumi.Int(0),
Offset: pulumi.Float64(0),
Width: pulumi.Float64(0),
},
},
Description: pulumi.String("string"),
Disabled: pulumi.Bool(false),
LabelExtractors: pulumi.StringMap{
"string": pulumi.String("string"),
},
MetricDescriptor: &logging.MetricMetricDescriptorArgs{
MetricKind: pulumi.String("string"),
ValueType: pulumi.String("string"),
DisplayName: pulumi.String("string"),
Labels: logging.MetricMetricDescriptorLabelArray{
&logging.MetricMetricDescriptorLabelArgs{
Key: pulumi.String("string"),
Description: pulumi.String("string"),
ValueType: pulumi.String("string"),
},
},
Unit: pulumi.String("string"),
},
Name: pulumi.String("string"),
Project: pulumi.String("string"),
ValueExtractor: pulumi.String("string"),
})
var metricResource = new Metric("metricResource", MetricArgs.builder()
.filter("string")
.bucketName("string")
.bucketOptions(MetricBucketOptionsArgs.builder()
.explicitBuckets(MetricBucketOptionsExplicitBucketsArgs.builder()
.bounds(0)
.build())
.exponentialBuckets(MetricBucketOptionsExponentialBucketsArgs.builder()
.growthFactor(0)
.numFiniteBuckets(0)
.scale(0)
.build())
.linearBuckets(MetricBucketOptionsLinearBucketsArgs.builder()
.numFiniteBuckets(0)
.offset(0)
.width(0)
.build())
.build())
.description("string")
.disabled(false)
.labelExtractors(Map.of("string", "string"))
.metricDescriptor(MetricMetricDescriptorArgs.builder()
.metricKind("string")
.valueType("string")
.displayName("string")
.labels(MetricMetricDescriptorLabelArgs.builder()
.key("string")
.description("string")
.valueType("string")
.build())
.unit("string")
.build())
.name("string")
.project("string")
.valueExtractor("string")
.build());
metric_resource = gcp.logging.Metric("metricResource",
filter="string",
bucket_name="string",
bucket_options={
"explicitBuckets": {
"bounds": [0],
},
"exponentialBuckets": {
"growthFactor": 0,
"numFiniteBuckets": 0,
"scale": 0,
},
"linearBuckets": {
"numFiniteBuckets": 0,
"offset": 0,
"width": 0,
},
},
description="string",
disabled=False,
label_extractors={
"string": "string",
},
metric_descriptor={
"metricKind": "string",
"valueType": "string",
"displayName": "string",
"labels": [{
"key": "string",
"description": "string",
"valueType": "string",
}],
"unit": "string",
},
name="string",
project="string",
value_extractor="string")
const metricResource = new gcp.logging.Metric("metricResource", {
filter: "string",
bucketName: "string",
bucketOptions: {
explicitBuckets: {
bounds: [0],
},
exponentialBuckets: {
growthFactor: 0,
numFiniteBuckets: 0,
scale: 0,
},
linearBuckets: {
numFiniteBuckets: 0,
offset: 0,
width: 0,
},
},
description: "string",
disabled: false,
labelExtractors: {
string: "string",
},
metricDescriptor: {
metricKind: "string",
valueType: "string",
displayName: "string",
labels: [{
key: "string",
description: "string",
valueType: "string",
}],
unit: "string",
},
name: "string",
project: "string",
valueExtractor: "string",
});
type: gcp:logging:Metric
properties:
bucketName: string
bucketOptions:
explicitBuckets:
bounds:
- 0
exponentialBuckets:
growthFactor: 0
numFiniteBuckets: 0
scale: 0
linearBuckets:
numFiniteBuckets: 0
offset: 0
width: 0
description: string
disabled: false
filter: string
labelExtractors:
string: string
metricDescriptor:
displayName: string
labels:
- description: string
key: string
valueType: string
metricKind: string
unit: string
valueType: string
name: string
project: string
valueExtractor: string
Metric Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The Metric resource accepts the following input properties:
- Filter string
- An advanced logs filter (https://cloud.google.com/logging/docs/view/advanced-filters) which
is used to match log entries.
- Bucket
Name string - The resource name of the Log Bucket that owns the Log Metric. Only Log Buckets in projects are supported. The bucket has to be in the same project as the metric.
- Bucket
Options MetricBucket Options - The bucketOptions are required when the logs-based metric is using a DISTRIBUTION value type and it describes the bucket boundaries used to create a histogram of the extracted values. Structure is documented below.
- Description string
- A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
- Disabled bool
- If set to True, then this metric is disabled and it does not generate any points.
- Label
Extractors Dictionary<string, string> - A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key specified in the LabelDescriptor must have an associated extractor expression in this map. The syntax of the extractor expression is the same as for the valueExtractor field.
- Metric
Descriptor MetricMetric Descriptor - The optional metric descriptor associated with the logs-based metric. If unspecified, it uses a default metric descriptor with a DELTA metric kind, INT64 value type, with no labels and a unit of "1". Such a metric counts the number of log entries matching the filter expression. Structure is documented below.
- Name string
- The client-assigned metric identifier. Examples - "error_count", "nginx/requests". Metric identifiers are limited to 100 characters and can include only the following characters A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Value
Extractor string - A valueExtractor is required when using a distribution logs-based metric to extract the values to record from a log entry. Two functions are supported for value extraction - EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are 1. field - The name of the log entry field from which the value is to be extracted. 2. regex - A regular expression using the Google RE2 syntax (https://github.com/google/re2/wiki/Syntax) with a single capture group to extract data from the specified log entry field. The value of the field is converted to a string before applying the regex. It is an error to specify a regex that does not include exactly one capture group.
- Filter string
- An advanced logs filter (https://cloud.google.com/logging/docs/view/advanced-filters) which
is used to match log entries.
- Bucket
Name string - The resource name of the Log Bucket that owns the Log Metric. Only Log Buckets in projects are supported. The bucket has to be in the same project as the metric.
- Bucket
Options MetricBucket Options Args - The bucketOptions are required when the logs-based metric is using a DISTRIBUTION value type and it describes the bucket boundaries used to create a histogram of the extracted values. Structure is documented below.
- Description string
- A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
- Disabled bool
- If set to True, then this metric is disabled and it does not generate any points.
- Label
Extractors map[string]string - A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key specified in the LabelDescriptor must have an associated extractor expression in this map. The syntax of the extractor expression is the same as for the valueExtractor field.
- Metric
Descriptor MetricMetric Descriptor Args - The optional metric descriptor associated with the logs-based metric. If unspecified, it uses a default metric descriptor with a DELTA metric kind, INT64 value type, with no labels and a unit of "1". Such a metric counts the number of log entries matching the filter expression. Structure is documented below.
- Name string
- The client-assigned metric identifier. Examples - "error_count", "nginx/requests". Metric identifiers are limited to 100 characters and can include only the following characters A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Value
Extractor string - A valueExtractor is required when using a distribution logs-based metric to extract the values to record from a log entry. Two functions are supported for value extraction - EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are 1. field - The name of the log entry field from which the value is to be extracted. 2. regex - A regular expression using the Google RE2 syntax (https://github.com/google/re2/wiki/Syntax) with a single capture group to extract data from the specified log entry field. The value of the field is converted to a string before applying the regex. It is an error to specify a regex that does not include exactly one capture group.
- filter String
- An advanced logs filter (https://cloud.google.com/logging/docs/view/advanced-filters) which
is used to match log entries.
- bucket
Name String - The resource name of the Log Bucket that owns the Log Metric. Only Log Buckets in projects are supported. The bucket has to be in the same project as the metric.
- bucket
Options MetricBucket Options - The bucketOptions are required when the logs-based metric is using a DISTRIBUTION value type and it describes the bucket boundaries used to create a histogram of the extracted values. Structure is documented below.
- description String
- A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
- disabled Boolean
- If set to True, then this metric is disabled and it does not generate any points.
- label
Extractors Map<String,String> - A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key specified in the LabelDescriptor must have an associated extractor expression in this map. The syntax of the extractor expression is the same as for the valueExtractor field.
- metric
Descriptor MetricMetric Descriptor - The optional metric descriptor associated with the logs-based metric. If unspecified, it uses a default metric descriptor with a DELTA metric kind, INT64 value type, with no labels and a unit of "1". Such a metric counts the number of log entries matching the filter expression. Structure is documented below.
- name String
- The client-assigned metric identifier. Examples - "error_count", "nginx/requests". Metric identifiers are limited to 100 characters and can include only the following characters A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- value
Extractor String - A valueExtractor is required when using a distribution logs-based metric to extract the values to record from a log entry. Two functions are supported for value extraction - EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are 1. field - The name of the log entry field from which the value is to be extracted. 2. regex - A regular expression using the Google RE2 syntax (https://github.com/google/re2/wiki/Syntax) with a single capture group to extract data from the specified log entry field. The value of the field is converted to a string before applying the regex. It is an error to specify a regex that does not include exactly one capture group.
- filter string
- An advanced logs filter (https://cloud.google.com/logging/docs/view/advanced-filters) which
is used to match log entries.
- bucket
Name string - The resource name of the Log Bucket that owns the Log Metric. Only Log Buckets in projects are supported. The bucket has to be in the same project as the metric.
- bucket
Options MetricBucket Options - The bucketOptions are required when the logs-based metric is using a DISTRIBUTION value type and it describes the bucket boundaries used to create a histogram of the extracted values. Structure is documented below.
- description string
- A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
- disabled boolean
- If set to True, then this metric is disabled and it does not generate any points.
- label
Extractors {[key: string]: string} - A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key specified in the LabelDescriptor must have an associated extractor expression in this map. The syntax of the extractor expression is the same as for the valueExtractor field.
- metric
Descriptor MetricMetric Descriptor - The optional metric descriptor associated with the logs-based metric. If unspecified, it uses a default metric descriptor with a DELTA metric kind, INT64 value type, with no labels and a unit of "1". Such a metric counts the number of log entries matching the filter expression. Structure is documented below.
- name string
- The client-assigned metric identifier. Examples - "error_count", "nginx/requests". Metric identifiers are limited to 100 characters and can include only the following characters A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- value
Extractor string - A valueExtractor is required when using a distribution logs-based metric to extract the values to record from a log entry. Two functions are supported for value extraction - EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are 1. field - The name of the log entry field from which the value is to be extracted. 2. regex - A regular expression using the Google RE2 syntax (https://github.com/google/re2/wiki/Syntax) with a single capture group to extract data from the specified log entry field. The value of the field is converted to a string before applying the regex. It is an error to specify a regex that does not include exactly one capture group.
- filter str
- An advanced logs filter (https://cloud.google.com/logging/docs/view/advanced-filters) which
is used to match log entries.
- bucket_
name str - The resource name of the Log Bucket that owns the Log Metric. Only Log Buckets in projects are supported. The bucket has to be in the same project as the metric.
- bucket_
options MetricBucket Options Args - The bucketOptions are required when the logs-based metric is using a DISTRIBUTION value type and it describes the bucket boundaries used to create a histogram of the extracted values. Structure is documented below.
- description str
- A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
- disabled bool
- If set to True, then this metric is disabled and it does not generate any points.
- label_
extractors Mapping[str, str] - A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key specified in the LabelDescriptor must have an associated extractor expression in this map. The syntax of the extractor expression is the same as for the valueExtractor field.
- metric_
descriptor MetricMetric Descriptor Args - The optional metric descriptor associated with the logs-based metric. If unspecified, it uses a default metric descriptor with a DELTA metric kind, INT64 value type, with no labels and a unit of "1". Such a metric counts the number of log entries matching the filter expression. Structure is documented below.
- name str
- The client-assigned metric identifier. Examples - "error_count", "nginx/requests". Metric identifiers are limited to 100 characters and can include only the following characters A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.
- project str
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- value_
extractor str - A valueExtractor is required when using a distribution logs-based metric to extract the values to record from a log entry. Two functions are supported for value extraction - EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are 1. field - The name of the log entry field from which the value is to be extracted. 2. regex - A regular expression using the Google RE2 syntax (https://github.com/google/re2/wiki/Syntax) with a single capture group to extract data from the specified log entry field. The value of the field is converted to a string before applying the regex. It is an error to specify a regex that does not include exactly one capture group.
- filter String
- An advanced logs filter (https://cloud.google.com/logging/docs/view/advanced-filters) which
is used to match log entries.
- bucket
Name String - The resource name of the Log Bucket that owns the Log Metric. Only Log Buckets in projects are supported. The bucket has to be in the same project as the metric.
- bucket
Options Property Map - The bucketOptions are required when the logs-based metric is using a DISTRIBUTION value type and it describes the bucket boundaries used to create a histogram of the extracted values. Structure is documented below.
- description String
- A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
- disabled Boolean
- If set to True, then this metric is disabled and it does not generate any points.
- label
Extractors Map<String> - A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key specified in the LabelDescriptor must have an associated extractor expression in this map. The syntax of the extractor expression is the same as for the valueExtractor field.
- metric
Descriptor Property Map - The optional metric descriptor associated with the logs-based metric. If unspecified, it uses a default metric descriptor with a DELTA metric kind, INT64 value type, with no labels and a unit of "1". Such a metric counts the number of log entries matching the filter expression. Structure is documented below.
- name String
- The client-assigned metric identifier. Examples - "error_count", "nginx/requests". Metric identifiers are limited to 100 characters and can include only the following characters A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- value
Extractor String - A valueExtractor is required when using a distribution logs-based metric to extract the values to record from a log entry. Two functions are supported for value extraction - EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are 1. field - The name of the log entry field from which the value is to be extracted. 2. regex - A regular expression using the Google RE2 syntax (https://github.com/google/re2/wiki/Syntax) with a single capture group to extract data from the specified log entry field. The value of the field is converted to a string before applying the regex. It is an error to specify a regex that does not include exactly one capture group.
Outputs
All input properties are implicitly available as output properties. Additionally, the Metric resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing Metric Resource
Get an existing Metric resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: MetricState, opts?: CustomResourceOptions): Metric
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
bucket_name: Optional[str] = None,
bucket_options: Optional[MetricBucketOptionsArgs] = None,
description: Optional[str] = None,
disabled: Optional[bool] = None,
filter: Optional[str] = None,
label_extractors: Optional[Mapping[str, str]] = None,
metric_descriptor: Optional[MetricMetricDescriptorArgs] = None,
name: Optional[str] = None,
project: Optional[str] = None,
value_extractor: Optional[str] = None) -> Metric
func GetMetric(ctx *Context, name string, id IDInput, state *MetricState, opts ...ResourceOption) (*Metric, error)
public static Metric Get(string name, Input<string> id, MetricState? state, CustomResourceOptions? opts = null)
public static Metric get(String name, Output<String> id, MetricState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Bucket
Name string - The resource name of the Log Bucket that owns the Log Metric. Only Log Buckets in projects are supported. The bucket has to be in the same project as the metric.
- Bucket
Options MetricBucket Options - The bucketOptions are required when the logs-based metric is using a DISTRIBUTION value type and it describes the bucket boundaries used to create a histogram of the extracted values. Structure is documented below.
- Description string
- A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
- Disabled bool
- If set to True, then this metric is disabled and it does not generate any points.
- Filter string
- An advanced logs filter (https://cloud.google.com/logging/docs/view/advanced-filters) which
is used to match log entries.
- Label
Extractors Dictionary<string, string> - A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key specified in the LabelDescriptor must have an associated extractor expression in this map. The syntax of the extractor expression is the same as for the valueExtractor field.
- Metric
Descriptor MetricMetric Descriptor - The optional metric descriptor associated with the logs-based metric. If unspecified, it uses a default metric descriptor with a DELTA metric kind, INT64 value type, with no labels and a unit of "1". Such a metric counts the number of log entries matching the filter expression. Structure is documented below.
- Name string
- The client-assigned metric identifier. Examples - "error_count", "nginx/requests". Metric identifiers are limited to 100 characters and can include only the following characters A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Value
Extractor string - A valueExtractor is required when using a distribution logs-based metric to extract the values to record from a log entry. Two functions are supported for value extraction - EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are 1. field - The name of the log entry field from which the value is to be extracted. 2. regex - A regular expression using the Google RE2 syntax (https://github.com/google/re2/wiki/Syntax) with a single capture group to extract data from the specified log entry field. The value of the field is converted to a string before applying the regex. It is an error to specify a regex that does not include exactly one capture group.
- Bucket
Name string - The resource name of the Log Bucket that owns the Log Metric. Only Log Buckets in projects are supported. The bucket has to be in the same project as the metric.
- Bucket
Options MetricBucket Options Args - The bucketOptions are required when the logs-based metric is using a DISTRIBUTION value type and it describes the bucket boundaries used to create a histogram of the extracted values. Structure is documented below.
- Description string
- A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
- Disabled bool
- If set to True, then this metric is disabled and it does not generate any points.
- Filter string
- An advanced logs filter (https://cloud.google.com/logging/docs/view/advanced-filters) which
is used to match log entries.
- Label
Extractors map[string]string - A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key specified in the LabelDescriptor must have an associated extractor expression in this map. The syntax of the extractor expression is the same as for the valueExtractor field.
- Metric
Descriptor MetricMetric Descriptor Args - The optional metric descriptor associated with the logs-based metric. If unspecified, it uses a default metric descriptor with a DELTA metric kind, INT64 value type, with no labels and a unit of "1". Such a metric counts the number of log entries matching the filter expression. Structure is documented below.
- Name string
- The client-assigned metric identifier. Examples - "error_count", "nginx/requests". Metric identifiers are limited to 100 characters and can include only the following characters A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.
- Project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- Value
Extractor string - A valueExtractor is required when using a distribution logs-based metric to extract the values to record from a log entry. Two functions are supported for value extraction - EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are 1. field - The name of the log entry field from which the value is to be extracted. 2. regex - A regular expression using the Google RE2 syntax (https://github.com/google/re2/wiki/Syntax) with a single capture group to extract data from the specified log entry field. The value of the field is converted to a string before applying the regex. It is an error to specify a regex that does not include exactly one capture group.
- bucket
Name String - The resource name of the Log Bucket that owns the Log Metric. Only Log Buckets in projects are supported. The bucket has to be in the same project as the metric.
- bucket
Options MetricBucket Options - The bucketOptions are required when the logs-based metric is using a DISTRIBUTION value type and it describes the bucket boundaries used to create a histogram of the extracted values. Structure is documented below.
- description String
- A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
- disabled Boolean
- If set to True, then this metric is disabled and it does not generate any points.
- filter String
- An advanced logs filter (https://cloud.google.com/logging/docs/view/advanced-filters) which
is used to match log entries.
- label
Extractors Map<String,String> - A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key specified in the LabelDescriptor must have an associated extractor expression in this map. The syntax of the extractor expression is the same as for the valueExtractor field.
- metric
Descriptor MetricMetric Descriptor - The optional metric descriptor associated with the logs-based metric. If unspecified, it uses a default metric descriptor with a DELTA metric kind, INT64 value type, with no labels and a unit of "1". Such a metric counts the number of log entries matching the filter expression. Structure is documented below.
- name String
- The client-assigned metric identifier. Examples - "error_count", "nginx/requests". Metric identifiers are limited to 100 characters and can include only the following characters A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- value
Extractor String - A valueExtractor is required when using a distribution logs-based metric to extract the values to record from a log entry. Two functions are supported for value extraction - EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are 1. field - The name of the log entry field from which the value is to be extracted. 2. regex - A regular expression using the Google RE2 syntax (https://github.com/google/re2/wiki/Syntax) with a single capture group to extract data from the specified log entry field. The value of the field is converted to a string before applying the regex. It is an error to specify a regex that does not include exactly one capture group.
- bucket
Name string - The resource name of the Log Bucket that owns the Log Metric. Only Log Buckets in projects are supported. The bucket has to be in the same project as the metric.
- bucket
Options MetricBucket Options - The bucketOptions are required when the logs-based metric is using a DISTRIBUTION value type and it describes the bucket boundaries used to create a histogram of the extracted values. Structure is documented below.
- description string
- A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
- disabled boolean
- If set to True, then this metric is disabled and it does not generate any points.
- filter string
- An advanced logs filter (https://cloud.google.com/logging/docs/view/advanced-filters) which
is used to match log entries.
- label
Extractors {[key: string]: string} - A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key specified in the LabelDescriptor must have an associated extractor expression in this map. The syntax of the extractor expression is the same as for the valueExtractor field.
- metric
Descriptor MetricMetric Descriptor - The optional metric descriptor associated with the logs-based metric. If unspecified, it uses a default metric descriptor with a DELTA metric kind, INT64 value type, with no labels and a unit of "1". Such a metric counts the number of log entries matching the filter expression. Structure is documented below.
- name string
- The client-assigned metric identifier. Examples - "error_count", "nginx/requests". Metric identifiers are limited to 100 characters and can include only the following characters A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.
- project string
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- value
Extractor string - A valueExtractor is required when using a distribution logs-based metric to extract the values to record from a log entry. Two functions are supported for value extraction - EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are 1. field - The name of the log entry field from which the value is to be extracted. 2. regex - A regular expression using the Google RE2 syntax (https://github.com/google/re2/wiki/Syntax) with a single capture group to extract data from the specified log entry field. The value of the field is converted to a string before applying the regex. It is an error to specify a regex that does not include exactly one capture group.
- bucket_
name str - The resource name of the Log Bucket that owns the Log Metric. Only Log Buckets in projects are supported. The bucket has to be in the same project as the metric.
- bucket_
options MetricBucket Options Args - The bucketOptions are required when the logs-based metric is using a DISTRIBUTION value type and it describes the bucket boundaries used to create a histogram of the extracted values. Structure is documented below.
- description str
- A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
- disabled bool
- If set to True, then this metric is disabled and it does not generate any points.
- filter str
- An advanced logs filter (https://cloud.google.com/logging/docs/view/advanced-filters) which
is used to match log entries.
- label_
extractors Mapping[str, str] - A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key specified in the LabelDescriptor must have an associated extractor expression in this map. The syntax of the extractor expression is the same as for the valueExtractor field.
- metric_
descriptor MetricMetric Descriptor Args - The optional metric descriptor associated with the logs-based metric. If unspecified, it uses a default metric descriptor with a DELTA metric kind, INT64 value type, with no labels and a unit of "1". Such a metric counts the number of log entries matching the filter expression. Structure is documented below.
- name str
- The client-assigned metric identifier. Examples - "error_count", "nginx/requests". Metric identifiers are limited to 100 characters and can include only the following characters A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.
- project str
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- value_
extractor str - A valueExtractor is required when using a distribution logs-based metric to extract the values to record from a log entry. Two functions are supported for value extraction - EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are 1. field - The name of the log entry field from which the value is to be extracted. 2. regex - A regular expression using the Google RE2 syntax (https://github.com/google/re2/wiki/Syntax) with a single capture group to extract data from the specified log entry field. The value of the field is converted to a string before applying the regex. It is an error to specify a regex that does not include exactly one capture group.
- bucket
Name String - The resource name of the Log Bucket that owns the Log Metric. Only Log Buckets in projects are supported. The bucket has to be in the same project as the metric.
- bucket
Options Property Map - The bucketOptions are required when the logs-based metric is using a DISTRIBUTION value type and it describes the bucket boundaries used to create a histogram of the extracted values. Structure is documented below.
- description String
- A description of this metric, which is used in documentation. The maximum length of the description is 8000 characters.
- disabled Boolean
- If set to True, then this metric is disabled and it does not generate any points.
- filter String
- An advanced logs filter (https://cloud.google.com/logging/docs/view/advanced-filters) which
is used to match log entries.
- label
Extractors Map<String> - A map from a label key string to an extractor expression which is used to extract data from a log entry field and assign as the label value. Each label key specified in the LabelDescriptor must have an associated extractor expression in this map. The syntax of the extractor expression is the same as for the valueExtractor field.
- metric
Descriptor Property Map - The optional metric descriptor associated with the logs-based metric. If unspecified, it uses a default metric descriptor with a DELTA metric kind, INT64 value type, with no labels and a unit of "1". Such a metric counts the number of log entries matching the filter expression. Structure is documented below.
- name String
- The client-assigned metric identifier. Examples - "error_count", "nginx/requests". Metric identifiers are limited to 100 characters and can include only the following characters A-Z, a-z, 0-9, and the special characters _-.,+!*',()%/. The forward-slash character (/) denotes a hierarchy of name pieces, and it cannot be the first character of the name.
- project String
- The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
- value
Extractor String - A valueExtractor is required when using a distribution logs-based metric to extract the values to record from a log entry. Two functions are supported for value extraction - EXTRACT(field) or REGEXP_EXTRACT(field, regex). The argument are 1. field - The name of the log entry field from which the value is to be extracted. 2. regex - A regular expression using the Google RE2 syntax (https://github.com/google/re2/wiki/Syntax) with a single capture group to extract data from the specified log entry field. The value of the field is converted to a string before applying the regex. It is an error to specify a regex that does not include exactly one capture group.
Supporting Types
MetricBucketOptions, MetricBucketOptionsArgs
- Explicit
Buckets MetricBucket Options Explicit Buckets - Specifies a set of buckets with arbitrary widths. Structure is documented below.
- Exponential
Buckets MetricBucket Options Exponential Buckets - Specifies an exponential sequence of buckets that have a width that is proportional to the value of the lower bound. Each bucket represents a constant relative uncertainty on a specific value in the bucket. Structure is documented below.
- Linear
Buckets MetricBucket Options Linear Buckets - Specifies a linear sequence of buckets that all have the same width (except overflow and underflow). Each bucket represents a constant absolute uncertainty on the specific value in the bucket. Structure is documented below.
- Explicit
Buckets MetricBucket Options Explicit Buckets - Specifies a set of buckets with arbitrary widths. Structure is documented below.
- Exponential
Buckets MetricBucket Options Exponential Buckets - Specifies an exponential sequence of buckets that have a width that is proportional to the value of the lower bound. Each bucket represents a constant relative uncertainty on a specific value in the bucket. Structure is documented below.
- Linear
Buckets MetricBucket Options Linear Buckets - Specifies a linear sequence of buckets that all have the same width (except overflow and underflow). Each bucket represents a constant absolute uncertainty on the specific value in the bucket. Structure is documented below.
- explicit
Buckets MetricBucket Options Explicit Buckets - Specifies a set of buckets with arbitrary widths. Structure is documented below.
- exponential
Buckets MetricBucket Options Exponential Buckets - Specifies an exponential sequence of buckets that have a width that is proportional to the value of the lower bound. Each bucket represents a constant relative uncertainty on a specific value in the bucket. Structure is documented below.
- linear
Buckets MetricBucket Options Linear Buckets - Specifies a linear sequence of buckets that all have the same width (except overflow and underflow). Each bucket represents a constant absolute uncertainty on the specific value in the bucket. Structure is documented below.
- explicit
Buckets MetricBucket Options Explicit Buckets - Specifies a set of buckets with arbitrary widths. Structure is documented below.
- exponential
Buckets MetricBucket Options Exponential Buckets - Specifies an exponential sequence of buckets that have a width that is proportional to the value of the lower bound. Each bucket represents a constant relative uncertainty on a specific value in the bucket. Structure is documented below.
- linear
Buckets MetricBucket Options Linear Buckets - Specifies a linear sequence of buckets that all have the same width (except overflow and underflow). Each bucket represents a constant absolute uncertainty on the specific value in the bucket. Structure is documented below.
- explicit_
buckets MetricBucket Options Explicit Buckets - Specifies a set of buckets with arbitrary widths. Structure is documented below.
- exponential_
buckets MetricBucket Options Exponential Buckets - Specifies an exponential sequence of buckets that have a width that is proportional to the value of the lower bound. Each bucket represents a constant relative uncertainty on a specific value in the bucket. Structure is documented below.
- linear_
buckets MetricBucket Options Linear Buckets - Specifies a linear sequence of buckets that all have the same width (except overflow and underflow). Each bucket represents a constant absolute uncertainty on the specific value in the bucket. Structure is documented below.
- explicit
Buckets Property Map - Specifies a set of buckets with arbitrary widths. Structure is documented below.
- exponential
Buckets Property Map - Specifies an exponential sequence of buckets that have a width that is proportional to the value of the lower bound. Each bucket represents a constant relative uncertainty on a specific value in the bucket. Structure is documented below.
- linear
Buckets Property Map - Specifies a linear sequence of buckets that all have the same width (except overflow and underflow). Each bucket represents a constant absolute uncertainty on the specific value in the bucket. Structure is documented below.
MetricBucketOptionsExplicitBuckets, MetricBucketOptionsExplicitBucketsArgs
- Bounds List<double>
- The values must be monotonically increasing.
- Bounds []float64
- The values must be monotonically increasing.
- bounds List<Double>
- The values must be monotonically increasing.
- bounds number[]
- The values must be monotonically increasing.
- bounds Sequence[float]
- The values must be monotonically increasing.
- bounds List<Number>
- The values must be monotonically increasing.
MetricBucketOptionsExponentialBuckets, MetricBucketOptionsExponentialBucketsArgs
- Growth
Factor double - Must be greater than 1.
- Num
Finite intBuckets - Must be greater than 0.
- Scale double
- Must be greater than 0.
- Growth
Factor float64 - Must be greater than 1.
- Num
Finite intBuckets - Must be greater than 0.
- Scale float64
- Must be greater than 0.
- growth
Factor Double - Must be greater than 1.
- num
Finite IntegerBuckets - Must be greater than 0.
- scale Double
- Must be greater than 0.
- growth
Factor number - Must be greater than 1.
- num
Finite numberBuckets - Must be greater than 0.
- scale number
- Must be greater than 0.
- growth_
factor float - Must be greater than 1.
- num_
finite_ intbuckets - Must be greater than 0.
- scale float
- Must be greater than 0.
- growth
Factor Number - Must be greater than 1.
- num
Finite NumberBuckets - Must be greater than 0.
- scale Number
- Must be greater than 0.
MetricBucketOptionsLinearBuckets, MetricBucketOptionsLinearBucketsArgs
- Num
Finite intBuckets - Must be greater than 0.
- Offset double
- Lower bound of the first bucket.
- Width double
- Must be greater than 0.
- Num
Finite intBuckets - Must be greater than 0.
- Offset float64
- Lower bound of the first bucket.
- Width float64
- Must be greater than 0.
- num
Finite IntegerBuckets - Must be greater than 0.
- offset Double
- Lower bound of the first bucket.
- width Double
- Must be greater than 0.
- num
Finite numberBuckets - Must be greater than 0.
- offset number
- Lower bound of the first bucket.
- width number
- Must be greater than 0.
- num_
finite_ intbuckets - Must be greater than 0.
- offset float
- Lower bound of the first bucket.
- width float
- Must be greater than 0.
- num
Finite NumberBuckets - Must be greater than 0.
- offset Number
- Lower bound of the first bucket.
- width Number
- Must be greater than 0.
MetricMetricDescriptor, MetricMetricDescriptorArgs
- Metric
Kind string - Whether the metric records instantaneous values, changes to a value, etc.
Some combinations of metricKind and valueType might not be supported.
For counter metrics, set this to DELTA.
Possible values are:
DELTA
,GAUGE
,CUMULATIVE
. - Value
Type string - Whether the measurement is an integer, a floating-point number, etc.
Some combinations of metricKind and valueType might not be supported.
For counter metrics, set this to INT64.
Possible values are:
BOOL
,INT64
,DOUBLE
,STRING
,DISTRIBUTION
,MONEY
. - Display
Name string - A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count". This field is optional but it is recommended to be set for any metrics associated with user-visible concepts, such as Quota.
- Labels
List<Metric
Metric Descriptor Label> - The set of labels that can be used to describe a specific instance of this metric type. For example, the appengine.googleapis.com/http/server/response_latencies metric type has a label for the HTTP response code, response_code, so you can look at latencies for successful responses or just for responses that failed. Structure is documented below.
- Unit string
- The unit in which the metric value is reported. It is only applicable if the valueType is
INT64
,DOUBLE
, orDISTRIBUTION
. The supported units are a subset of The Unified Code for Units of Measure standard
- Metric
Kind string - Whether the metric records instantaneous values, changes to a value, etc.
Some combinations of metricKind and valueType might not be supported.
For counter metrics, set this to DELTA.
Possible values are:
DELTA
,GAUGE
,CUMULATIVE
. - Value
Type string - Whether the measurement is an integer, a floating-point number, etc.
Some combinations of metricKind and valueType might not be supported.
For counter metrics, set this to INT64.
Possible values are:
BOOL
,INT64
,DOUBLE
,STRING
,DISTRIBUTION
,MONEY
. - Display
Name string - A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count". This field is optional but it is recommended to be set for any metrics associated with user-visible concepts, such as Quota.
- Labels
[]Metric
Metric Descriptor Label - The set of labels that can be used to describe a specific instance of this metric type. For example, the appengine.googleapis.com/http/server/response_latencies metric type has a label for the HTTP response code, response_code, so you can look at latencies for successful responses or just for responses that failed. Structure is documented below.
- Unit string
- The unit in which the metric value is reported. It is only applicable if the valueType is
INT64
,DOUBLE
, orDISTRIBUTION
. The supported units are a subset of The Unified Code for Units of Measure standard
- metric
Kind String - Whether the metric records instantaneous values, changes to a value, etc.
Some combinations of metricKind and valueType might not be supported.
For counter metrics, set this to DELTA.
Possible values are:
DELTA
,GAUGE
,CUMULATIVE
. - value
Type String - Whether the measurement is an integer, a floating-point number, etc.
Some combinations of metricKind and valueType might not be supported.
For counter metrics, set this to INT64.
Possible values are:
BOOL
,INT64
,DOUBLE
,STRING
,DISTRIBUTION
,MONEY
. - display
Name String - A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count". This field is optional but it is recommended to be set for any metrics associated with user-visible concepts, such as Quota.
- labels
List<Metric
Metric Descriptor Label> - The set of labels that can be used to describe a specific instance of this metric type. For example, the appengine.googleapis.com/http/server/response_latencies metric type has a label for the HTTP response code, response_code, so you can look at latencies for successful responses or just for responses that failed. Structure is documented below.
- unit String
- The unit in which the metric value is reported. It is only applicable if the valueType is
INT64
,DOUBLE
, orDISTRIBUTION
. The supported units are a subset of The Unified Code for Units of Measure standard
- metric
Kind string - Whether the metric records instantaneous values, changes to a value, etc.
Some combinations of metricKind and valueType might not be supported.
For counter metrics, set this to DELTA.
Possible values are:
DELTA
,GAUGE
,CUMULATIVE
. - value
Type string - Whether the measurement is an integer, a floating-point number, etc.
Some combinations of metricKind and valueType might not be supported.
For counter metrics, set this to INT64.
Possible values are:
BOOL
,INT64
,DOUBLE
,STRING
,DISTRIBUTION
,MONEY
. - display
Name string - A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count". This field is optional but it is recommended to be set for any metrics associated with user-visible concepts, such as Quota.
- labels
Metric
Metric Descriptor Label[] - The set of labels that can be used to describe a specific instance of this metric type. For example, the appengine.googleapis.com/http/server/response_latencies metric type has a label for the HTTP response code, response_code, so you can look at latencies for successful responses or just for responses that failed. Structure is documented below.
- unit string
- The unit in which the metric value is reported. It is only applicable if the valueType is
INT64
,DOUBLE
, orDISTRIBUTION
. The supported units are a subset of The Unified Code for Units of Measure standard
- metric_
kind str - Whether the metric records instantaneous values, changes to a value, etc.
Some combinations of metricKind and valueType might not be supported.
For counter metrics, set this to DELTA.
Possible values are:
DELTA
,GAUGE
,CUMULATIVE
. - value_
type str - Whether the measurement is an integer, a floating-point number, etc.
Some combinations of metricKind and valueType might not be supported.
For counter metrics, set this to INT64.
Possible values are:
BOOL
,INT64
,DOUBLE
,STRING
,DISTRIBUTION
,MONEY
. - display_
name str - A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count". This field is optional but it is recommended to be set for any metrics associated with user-visible concepts, such as Quota.
- labels
Sequence[Metric
Metric Descriptor Label] - The set of labels that can be used to describe a specific instance of this metric type. For example, the appengine.googleapis.com/http/server/response_latencies metric type has a label for the HTTP response code, response_code, so you can look at latencies for successful responses or just for responses that failed. Structure is documented below.
- unit str
- The unit in which the metric value is reported. It is only applicable if the valueType is
INT64
,DOUBLE
, orDISTRIBUTION
. The supported units are a subset of The Unified Code for Units of Measure standard
- metric
Kind String - Whether the metric records instantaneous values, changes to a value, etc.
Some combinations of metricKind and valueType might not be supported.
For counter metrics, set this to DELTA.
Possible values are:
DELTA
,GAUGE
,CUMULATIVE
. - value
Type String - Whether the measurement is an integer, a floating-point number, etc.
Some combinations of metricKind and valueType might not be supported.
For counter metrics, set this to INT64.
Possible values are:
BOOL
,INT64
,DOUBLE
,STRING
,DISTRIBUTION
,MONEY
. - display
Name String - A concise name for the metric, which can be displayed in user interfaces. Use sentence case without an ending period, for example "Request count". This field is optional but it is recommended to be set for any metrics associated with user-visible concepts, such as Quota.
- labels List<Property Map>
- The set of labels that can be used to describe a specific instance of this metric type. For example, the appengine.googleapis.com/http/server/response_latencies metric type has a label for the HTTP response code, response_code, so you can look at latencies for successful responses or just for responses that failed. Structure is documented below.
- unit String
- The unit in which the metric value is reported. It is only applicable if the valueType is
INT64
,DOUBLE
, orDISTRIBUTION
. The supported units are a subset of The Unified Code for Units of Measure standard
MetricMetricDescriptorLabel, MetricMetricDescriptorLabelArgs
- Key string
- The label key.
- Description string
- A human-readable description for the label.
- Value
Type string - The type of data that can be assigned to the label.
Default value is
STRING
. Possible values are:BOOL
,INT64
,STRING
.
- Key string
- The label key.
- Description string
- A human-readable description for the label.
- Value
Type string - The type of data that can be assigned to the label.
Default value is
STRING
. Possible values are:BOOL
,INT64
,STRING
.
- key String
- The label key.
- description String
- A human-readable description for the label.
- value
Type String - The type of data that can be assigned to the label.
Default value is
STRING
. Possible values are:BOOL
,INT64
,STRING
.
- key string
- The label key.
- description string
- A human-readable description for the label.
- value
Type string - The type of data that can be assigned to the label.
Default value is
STRING
. Possible values are:BOOL
,INT64
,STRING
.
- key str
- The label key.
- description str
- A human-readable description for the label.
- value_
type str - The type of data that can be assigned to the label.
Default value is
STRING
. Possible values are:BOOL
,INT64
,STRING
.
- key String
- The label key.
- description String
- A human-readable description for the label.
- value
Type String - The type of data that can be assigned to the label.
Default value is
STRING
. Possible values are:BOOL
,INT64
,STRING
.
Import
Metric can be imported using any of these accepted formats:
{{project}} {{name}}
{{name}}
When using the pulumi import
command, Metric can be imported using one of the formats above. For example:
$ pulumi import gcp:logging/metric:Metric default {{project}} {{name}}
$ pulumi import gcp:logging/metric:Metric default {{name}}
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- Google Cloud (GCP) Classic pulumi/pulumi-gcp
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
google-beta
Terraform Provider.