LogsMetric
Resource for interacting with the logs_metric API
Schema
Required
- compute (Block List, Min: 1, Max: 1) The compute rule to compute the log-based metric. This field can’t be updated after creation. (see below for nested schema)
- filter (Block List, Min: 1, Max: 1) The log-based metric filter. Logs matching this filter will be aggregated in this metric. (see below for nested schema)
- name (String, Required) The name of the log-based metric. This field can’t be updated after creation.
Optional
- group_by (Block List) The rules for the group by. (see below for nested schema)
- id (String, Optional) The ID of this resource.
Nested Schema for compute
Required:
- aggregation_type (String, Required) The type of aggregation to use. This field can’t be updated after creation.
Optional:
- path (String, Optional) The path to the value the log-based metric will aggregate on (only used if the aggregation type is a “distribution”). This field can’t be updated after creation.
Nested Schema for filter
Required:
- query (String, Required) The search query - following the log search syntax.
Nested Schema for group_by
Required:
- path (String, Required) The path to the value the log-based metric will be aggregated over.
- tag_name (String, Required) Name of the tag that gets created.
Example Usage
using Pulumi;
using Datadog = Pulumi.Datadog;
class MyStack : Stack
{
public MyStack()
{
var testingLogsMetric = new Datadog.LogsMetric("testingLogsMetric", new Datadog.LogsMetricArgs
{
Compute = new Datadog.Inputs.LogsMetricComputeArgs
{
AggregationType = "distribution",
Path = "@duration",
},
Filter = new Datadog.Inputs.LogsMetricFilterArgs
{
Query = "service:test",
},
GroupBies =
{
new Datadog.Inputs.LogsMetricGroupByArgs
{
Path = "@status",
TagName = "status",
},
},
Name = "testing.logs.metric",
});
}
}
package main
import (
"github.com/pulumi/pulumi-datadog/sdk/v2/go/datadog"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := datadog.NewLogsMetric(ctx, "testingLogsMetric", &datadog.LogsMetricArgs{
Compute: &datadog.LogsMetricComputeArgs{
AggregationType: pulumi.String("distribution"),
Path: pulumi.String("@duration"),
},
Filter: &datadog.LogsMetricFilterArgs{
Query: pulumi.String("service:test"),
},
GroupBies: datadog.LogsMetricGroupByArray{
&datadog.LogsMetricGroupByArgs{
Path: pulumi.String("@status"),
TagName: pulumi.String("status"),
},
},
Name: pulumi.String("testing.logs.metric"),
})
if err != nil {
return err
}
return nil
})
}
import pulumi
import pulumi_datadog as datadog
testing_logs_metric = datadog.LogsMetric("testingLogsMetric",
compute=datadog.LogsMetricComputeArgs(
aggregation_type="distribution",
path="@duration",
),
filter=datadog.LogsMetricFilterArgs(
query="service:test",
),
group_bies=[datadog.LogsMetricGroupByArgs(
path="@status",
tag_name="status",
)],
name="testing.logs.metric")
import * as pulumi from "@pulumi/pulumi";
import * as datadog from "@pulumi/datadog";
const testingLogsMetric = new datadog.LogsMetric("testing_logs_metric", {
compute: {
aggregationType: "distribution",
path: "@duration",
},
filter: {
query: "service:test",
},
groupBies: [{
path: "@status",
tagName: "status",
}],
name: "testing.logs.metric",
});
Create a LogsMetric Resource
new LogsMetric(name: string, args: LogsMetricArgs, opts?: CustomResourceOptions);
def LogsMetric(resource_name: str, opts: Optional[ResourceOptions] = None, compute: Optional[LogsMetricComputeArgs] = None, filter: Optional[LogsMetricFilterArgs] = None, group_bies: Optional[Sequence[LogsMetricGroupByArgs]] = None, name: Optional[str] = None)
func NewLogsMetric(ctx *Context, name string, args LogsMetricArgs, opts ...ResourceOption) (*LogsMetric, error)
public LogsMetric(string name, LogsMetricArgs args, CustomResourceOptions? opts = null)
- name string
- The unique name of the resource.
- args LogsMetricArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args LogsMetricArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args LogsMetricArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
LogsMetric Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The LogsMetric resource accepts the following input properties:
- Compute
Logs
Metric Compute Args The compute rule to compute the log-based metric. This field can’t be updated after creation.
- Filter
Logs
Metric Filter Args The log-based metric filter. Logs matching this filter will be aggregated in this metric.
- Name string
The name of the log-based metric. This field can’t be updated after creation.
- Group
Bies List<LogsMetric Group By Args> The rules for the group by.
- Compute
Logs
Metric Compute The compute rule to compute the log-based metric. This field can’t be updated after creation.
- Filter
Logs
Metric Filter The log-based metric filter. Logs matching this filter will be aggregated in this metric.
- Name string
The name of the log-based metric. This field can’t be updated after creation.
- Group
Bies []LogsMetric Group By The rules for the group by.
- compute
Logs
Metric Compute The compute rule to compute the log-based metric. This field can’t be updated after creation.
- filter
Logs
Metric Filter The log-based metric filter. Logs matching this filter will be aggregated in this metric.
- name string
The name of the log-based metric. This field can’t be updated after creation.
- group
Bies LogsMetric Group By[] The rules for the group by.
- compute
Logs
Metric Compute Args The compute rule to compute the log-based metric. This field can’t be updated after creation.
- filter
Logs
Metric Filter Args The log-based metric filter. Logs matching this filter will be aggregated in this metric.
- name str
The name of the log-based metric. This field can’t be updated after creation.
- group_
bies Sequence[LogsMetric Group By Args] The rules for the group by.
Outputs
All input properties are implicitly available as output properties. Additionally, the LogsMetric 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 str
- The provider-assigned unique ID for this managed resource.
Look up an Existing LogsMetric Resource
Get an existing LogsMetric 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?: LogsMetricState, opts?: CustomResourceOptions): LogsMetric
@staticmethod
def get(resource_name: str, id: str, opts: Optional[ResourceOptions] = None, compute: Optional[LogsMetricComputeArgs] = None, filter: Optional[LogsMetricFilterArgs] = None, group_bies: Optional[Sequence[LogsMetricGroupByArgs]] = None, name: Optional[str] = None) -> LogsMetric
func GetLogsMetric(ctx *Context, name string, id IDInput, state *LogsMetricState, opts ...ResourceOption) (*LogsMetric, error)
public static LogsMetric Get(string name, Input<string> id, LogsMetricState? state, CustomResourceOptions? opts = null)
- 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.
The following state arguments are supported:
- Compute
Logs
Metric Compute Args The compute rule to compute the log-based metric. This field can’t be updated after creation.
- Filter
Logs
Metric Filter Args The log-based metric filter. Logs matching this filter will be aggregated in this metric.
- Group
Bies List<LogsMetric Group By Args> The rules for the group by.
- Name string
The name of the log-based metric. This field can’t be updated after creation.
- Compute
Logs
Metric Compute The compute rule to compute the log-based metric. This field can’t be updated after creation.
- Filter
Logs
Metric Filter The log-based metric filter. Logs matching this filter will be aggregated in this metric.
- Group
Bies []LogsMetric Group By The rules for the group by.
- Name string
The name of the log-based metric. This field can’t be updated after creation.
- compute
Logs
Metric Compute The compute rule to compute the log-based metric. This field can’t be updated after creation.
- filter
Logs
Metric Filter The log-based metric filter. Logs matching this filter will be aggregated in this metric.
- group
Bies LogsMetric Group By[] The rules for the group by.
- name string
The name of the log-based metric. This field can’t be updated after creation.
- compute
Logs
Metric Compute Args The compute rule to compute the log-based metric. This field can’t be updated after creation.
- filter
Logs
Metric Filter Args The log-based metric filter. Logs matching this filter will be aggregated in this metric.
- group_
bies Sequence[LogsMetric Group By Args] The rules for the group by.
- name str
The name of the log-based metric. This field can’t be updated after creation.
Supporting Types
LogsMetricCompute
- Aggregation
Type string - Path string
- Aggregation
Type string - Path string
- aggregation
Type string - path string
- aggregation_
type str - path str
LogsMetricFilter
- Query string
- Query string
- query string
- query str
LogsMetricGroupBy
Import
Import is supported using the following syntax
$ pulumi import datadog:index/logsMetric:LogsMetric testing_logs_metric testing.logs.metric
Package Details
- Repository
- https://github.com/pulumi/pulumi-datadog
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
datadog
Terraform Provider.