datadog.LogsMetric
Explore with Pulumi AI
Resource for interacting with the logs_metric API
Example Usage
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Datadog = Pulumi.Datadog;
return await Deployment.RunAsync(() =>
{
var testingLogsMetric = new Datadog.LogsMetric("testingLogsMetric", new()
{
Compute = new Datadog.Inputs.LogsMetricComputeArgs
{
AggregationType = "distribution",
Path = "@duration",
},
Filter = new Datadog.Inputs.LogsMetricFilterArgs
{
Query = "service:test",
},
GroupBies = new[]
{
new Datadog.Inputs.LogsMetricGroupByArgs
{
Path = "@status",
TagName = "status",
},
new Datadog.Inputs.LogsMetricGroupByArgs
{
Path = "@version",
TagName = "version",
},
},
Name = "testing.logs.metric",
});
});
package main
import (
"github.com/pulumi/pulumi-datadog/sdk/v4/go/datadog"
"github.com/pulumi/pulumi/sdk/v3/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"),
},
&datadog.LogsMetricGroupByArgs{
Path: pulumi.String("@version"),
TagName: pulumi.String("version"),
},
},
Name: pulumi.String("testing.logs.metric"),
})
if err != nil {
return err
}
return nil
})
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.datadog.LogsMetric;
import com.pulumi.datadog.LogsMetricArgs;
import com.pulumi.datadog.inputs.LogsMetricComputeArgs;
import com.pulumi.datadog.inputs.LogsMetricFilterArgs;
import com.pulumi.datadog.inputs.LogsMetricGroupByArgs;
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 testingLogsMetric = new LogsMetric("testingLogsMetric", LogsMetricArgs.builder()
.compute(LogsMetricComputeArgs.builder()
.aggregationType("distribution")
.path("@duration")
.build())
.filter(LogsMetricFilterArgs.builder()
.query("service:test")
.build())
.groupBies(
LogsMetricGroupByArgs.builder()
.path("@status")
.tagName("status")
.build(),
LogsMetricGroupByArgs.builder()
.path("@version")
.tagName("version")
.build())
.name("testing.logs.metric")
.build());
}
}
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",
),
datadog.LogsMetricGroupByArgs(
path="@version",
tag_name="version",
),
],
name="testing.logs.metric")
import * as pulumi from "@pulumi/pulumi";
import * as datadog from "@pulumi/datadog";
const testingLogsMetric = new datadog.LogsMetric("testingLogsMetric", {
compute: {
aggregationType: "distribution",
path: "@duration",
},
filter: {
query: "service:test",
},
groupBies: [
{
path: "@status",
tagName: "status",
},
{
path: "@version",
tagName: "version",
},
],
name: "testing.logs.metric",
});
resources:
testingLogsMetric:
type: datadog:LogsMetric
properties:
compute:
aggregationType: distribution
path: '@duration'
filter:
query: service:test
groupBies:
- path: '@status'
tagName: status
- path: '@version'
tagName: version
name: testing.logs.metric
Create LogsMetric Resource
new LogsMetric(name: string, args: LogsMetricArgs, opts?: CustomResourceOptions);
@overload
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)
@overload
def LogsMetric(resource_name: str,
args: LogsMetricArgs,
opts: Optional[ResourceOptions] = None)
func NewLogsMetric(ctx *Context, name string, args LogsMetricArgs, opts ...ResourceOption) (*LogsMetric, error)
public LogsMetric(string name, LogsMetricArgs args, CustomResourceOptions? opts = null)
public LogsMetric(String name, LogsMetricArgs args)
public LogsMetric(String name, LogsMetricArgs args, CustomResourceOptions options)
type: datadog:LogsMetric
properties: # The arguments to resource properties.
options: # 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.
- resource_name str
- The unique name of the resource.
- args LogsMetricArgs
- 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 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.
- name String
- The unique name of the resource.
- args LogsMetricArgs
- The arguments to resource properties.
- options 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 Architecture and Concepts docs.
Inputs
The LogsMetric resource accepts the following input properties:
- 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 List<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 string
The name of the log-based metric. This field can't be updated after creation.
- Group
Bies []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 List<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.
- compute Property Map
The compute rule to compute the log-based metric. This field can't be updated after creation.
- filter Property Map
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<Property Map> 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 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 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)
public static LogsMetric get(String name, Output<String> id, LogsMetricState 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.
- 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 List<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 []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 List<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.
- compute Property Map
The compute rule to compute the log-based metric. This field can't be updated after creation.
- filter Property Map
The log-based metric filter. Logs matching this filter will be aggregated in this metric.
- group
Bies List<Property Map> The rules for the group by.
- name String
The name of the log-based metric. This field can't be updated after creation.
Supporting Types
LogsMetricCompute, LogsMetricComputeArgs
- Aggregation
Type string The type of aggregation to use. This field can't be updated after creation. Valid values are
count
,distribution
.- Include
Percentiles bool Toggle to include/exclude percentiles for a distribution metric. Defaults to false. Can only be applied to metrics that have an
aggregation_type
of distribution.- Path string
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.
- Aggregation
Type string The type of aggregation to use. This field can't be updated after creation. Valid values are
count
,distribution
.- Include
Percentiles bool Toggle to include/exclude percentiles for a distribution metric. Defaults to false. Can only be applied to metrics that have an
aggregation_type
of distribution.- Path string
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.
- aggregation
Type String The type of aggregation to use. This field can't be updated after creation. Valid values are
count
,distribution
.- include
Percentiles Boolean Toggle to include/exclude percentiles for a distribution metric. Defaults to false. Can only be applied to metrics that have an
aggregation_type
of distribution.- path String
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.
- aggregation
Type string The type of aggregation to use. This field can't be updated after creation. Valid values are
count
,distribution
.- include
Percentiles boolean Toggle to include/exclude percentiles for a distribution metric. Defaults to false. Can only be applied to metrics that have an
aggregation_type
of distribution.- path string
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.
- aggregation_
type str The type of aggregation to use. This field can't be updated after creation. Valid values are
count
,distribution
.- include_
percentiles bool Toggle to include/exclude percentiles for a distribution metric. Defaults to false. Can only be applied to metrics that have an
aggregation_type
of distribution.- path str
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.
- aggregation
Type String The type of aggregation to use. This field can't be updated after creation. Valid values are
count
,distribution
.- include
Percentiles Boolean Toggle to include/exclude percentiles for a distribution metric. Defaults to false. Can only be applied to metrics that have an
aggregation_type
of distribution.- path String
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.
LogsMetricFilter, LogsMetricFilterArgs
- Query string
The search query - following the log search syntax.
- Query string
The search query - following the log search syntax.
- query String
The search query - following the log search syntax.
- query string
The search query - following the log search syntax.
- query str
The search query - following the log search syntax.
- query String
The search query - following the log search syntax.
LogsMetricGroupBy, LogsMetricGroupByArgs
Import
$ pulumi import datadog:index/logsMetric:LogsMetric testing_logs_metric testing.logs.metric
Package Details
- Repository
- Datadog pulumi/pulumi-datadog
- License
- Apache-2.0
- Notes
This Pulumi package is based on the
datadog
Terraform Provider.