1. Packages
  2. Datadog Provider
  3. API Docs
  4. LogsMetric
Datadog v4.36.1 published on Friday, Nov 15, 2024 by Pulumi

datadog.LogsMetric

Explore with Pulumi AI

datadog logo
Datadog v4.36.1 published on Friday, Nov 15, 2024 by Pulumi

    Resource for interacting with the logs_metric API

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as datadog from "@pulumi/datadog";
    
    const testingLogsMetric = new datadog.LogsMetric("testing_logs_metric", {
        name: "testing.logs.metric",
        compute: {
            aggregationType: "distribution",
            path: "@duration",
        },
        filter: {
            query: "service:test",
        },
        groupBies: [
            {
                path: "@status",
                tagName: "status",
            },
            {
                path: "@version",
                tagName: "version",
            },
        ],
    });
    
    import pulumi
    import pulumi_datadog as datadog
    
    testing_logs_metric = datadog.LogsMetric("testing_logs_metric",
        name="testing.logs.metric",
        compute={
            "aggregation_type": "distribution",
            "path": "@duration",
        },
        filter={
            "query": "service:test",
        },
        group_bies=[
            {
                "path": "@status",
                "tag_name": "status",
            },
            {
                "path": "@version",
                "tag_name": "version",
            },
        ])
    
    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, "testing_logs_metric", &datadog.LogsMetricArgs{
    			Name: pulumi.String("testing.logs.metric"),
    			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"),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Datadog = Pulumi.Datadog;
    
    return await Deployment.RunAsync(() => 
    {
        var testingLogsMetric = new Datadog.LogsMetric("testing_logs_metric", new()
        {
            Name = "testing.logs.metric",
            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",
                },
            },
        });
    
    });
    
    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()
                .name("testing.logs.metric")
                .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())
                .build());
    
        }
    }
    
    resources:
      testingLogsMetric:
        type: datadog:LogsMetric
        name: testing_logs_metric
        properties:
          name: testing.logs.metric
          compute:
            aggregationType: distribution
            path: '@duration'
          filter:
            query: service:test
          groupBies:
            - path: '@status'
              tagName: status
            - path: '@version'
              tagName: version
    

    Create LogsMetric Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new LogsMetric(name: string, args: LogsMetricArgs, opts?: CustomResourceOptions);
    @overload
    def LogsMetric(resource_name: str,
                   args: LogsMetricArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def LogsMetric(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   compute: Optional[LogsMetricComputeArgs] = None,
                   filter: Optional[LogsMetricFilterArgs] = None,
                   name: Optional[str] = None,
                   group_bies: Optional[Sequence[LogsMetricGroupByArgs]] = 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.
    
    

    Parameters

    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.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var logsMetricResource = new Datadog.LogsMetric("logsMetricResource", new()
    {
        Compute = new Datadog.Inputs.LogsMetricComputeArgs
        {
            AggregationType = "string",
            IncludePercentiles = false,
            Path = "string",
        },
        Filter = new Datadog.Inputs.LogsMetricFilterArgs
        {
            Query = "string",
        },
        Name = "string",
        GroupBies = new[]
        {
            new Datadog.Inputs.LogsMetricGroupByArgs
            {
                Path = "string",
                TagName = "string",
            },
        },
    });
    
    example, err := datadog.NewLogsMetric(ctx, "logsMetricResource", &datadog.LogsMetricArgs{
    	Compute: &datadog.LogsMetricComputeArgs{
    		AggregationType:    pulumi.String("string"),
    		IncludePercentiles: pulumi.Bool(false),
    		Path:               pulumi.String("string"),
    	},
    	Filter: &datadog.LogsMetricFilterArgs{
    		Query: pulumi.String("string"),
    	},
    	Name: pulumi.String("string"),
    	GroupBies: datadog.LogsMetricGroupByArray{
    		&datadog.LogsMetricGroupByArgs{
    			Path:    pulumi.String("string"),
    			TagName: pulumi.String("string"),
    		},
    	},
    })
    
    var logsMetricResource = new LogsMetric("logsMetricResource", LogsMetricArgs.builder()
        .compute(LogsMetricComputeArgs.builder()
            .aggregationType("string")
            .includePercentiles(false)
            .path("string")
            .build())
        .filter(LogsMetricFilterArgs.builder()
            .query("string")
            .build())
        .name("string")
        .groupBies(LogsMetricGroupByArgs.builder()
            .path("string")
            .tagName("string")
            .build())
        .build());
    
    logs_metric_resource = datadog.LogsMetric("logsMetricResource",
        compute={
            "aggregation_type": "string",
            "include_percentiles": False,
            "path": "string",
        },
        filter={
            "query": "string",
        },
        name="string",
        group_bies=[{
            "path": "string",
            "tag_name": "string",
        }])
    
    const logsMetricResource = new datadog.LogsMetric("logsMetricResource", {
        compute: {
            aggregationType: "string",
            includePercentiles: false,
            path: "string",
        },
        filter: {
            query: "string",
        },
        name: "string",
        groupBies: [{
            path: "string",
            tagName: "string",
        }],
    });
    
    type: datadog:LogsMetric
    properties:
        compute:
            aggregationType: string
            includePercentiles: false
            path: string
        filter:
            query: string
        groupBies:
            - path: string
              tagName: string
        name: string
    

    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

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    The LogsMetric resource accepts the following input properties:

    Compute LogsMetricCompute
    The compute rule to compute the log-based metric. This field can't be updated after creation.
    Filter LogsMetricFilter
    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.
    GroupBies List<LogsMetricGroupBy>
    The rules for the group by.
    Compute LogsMetricComputeArgs
    The compute rule to compute the log-based metric. This field can't be updated after creation.
    Filter LogsMetricFilterArgs
    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.
    GroupBies []LogsMetricGroupByArgs
    The rules for the group by.
    compute LogsMetricCompute
    The compute rule to compute the log-based metric. This field can't be updated after creation.
    filter LogsMetricFilter
    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.
    groupBies List<LogsMetricGroupBy>
    The rules for the group by.
    compute LogsMetricCompute
    The compute rule to compute the log-based metric. This field can't be updated after creation.
    filter LogsMetricFilter
    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.
    groupBies LogsMetricGroupBy[]
    The rules for the group by.
    compute LogsMetricComputeArgs
    The compute rule to compute the log-based metric. This field can't be updated after creation.
    filter LogsMetricFilterArgs
    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[LogsMetricGroupByArgs]
    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.
    groupBies 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.
    The following state arguments are supported:
    Compute LogsMetricCompute
    The compute rule to compute the log-based metric. This field can't be updated after creation.
    Filter LogsMetricFilter
    The log-based metric filter. Logs matching this filter will be aggregated in this metric.
    GroupBies List<LogsMetricGroupBy>
    The rules for the group by.
    Name string
    The name of the log-based metric. This field can't be updated after creation.
    Compute LogsMetricComputeArgs
    The compute rule to compute the log-based metric. This field can't be updated after creation.
    Filter LogsMetricFilterArgs
    The log-based metric filter. Logs matching this filter will be aggregated in this metric.
    GroupBies []LogsMetricGroupByArgs
    The rules for the group by.
    Name string
    The name of the log-based metric. This field can't be updated after creation.
    compute LogsMetricCompute
    The compute rule to compute the log-based metric. This field can't be updated after creation.
    filter LogsMetricFilter
    The log-based metric filter. Logs matching this filter will be aggregated in this metric.
    groupBies List<LogsMetricGroupBy>
    The rules for the group by.
    name String
    The name of the log-based metric. This field can't be updated after creation.
    compute LogsMetricCompute
    The compute rule to compute the log-based metric. This field can't be updated after creation.
    filter LogsMetricFilter
    The log-based metric filter. Logs matching this filter will be aggregated in this metric.
    groupBies LogsMetricGroupBy[]
    The rules for the group by.
    name string
    The name of the log-based metric. This field can't be updated after creation.
    compute LogsMetricComputeArgs
    The compute rule to compute the log-based metric. This field can't be updated after creation.
    filter LogsMetricFilterArgs
    The log-based metric filter. Logs matching this filter will be aggregated in this metric.
    group_bies Sequence[LogsMetricGroupByArgs]
    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.
    groupBies 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

    AggregationType string
    The type of aggregation to use. This field can't be updated after creation. Valid values are count, distribution.
    IncludePercentiles 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.
    AggregationType string
    The type of aggregation to use. This field can't be updated after creation. Valid values are count, distribution.
    IncludePercentiles 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.
    aggregationType String
    The type of aggregation to use. This field can't be updated after creation. Valid values are count, distribution.
    includePercentiles 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.
    aggregationType string
    The type of aggregation to use. This field can't be updated after creation. Valid values are count, distribution.
    includePercentiles 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.
    aggregationType String
    The type of aggregation to use. This field can't be updated after creation. Valid values are count, distribution.
    includePercentiles 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

    Path string
    The path to the value the log-based metric will be aggregated over.
    TagName string
    Name of the tag that gets created.
    Path string
    The path to the value the log-based metric will be aggregated over.
    TagName string
    Name of the tag that gets created.
    path String
    The path to the value the log-based metric will be aggregated over.
    tagName String
    Name of the tag that gets created.
    path string
    The path to the value the log-based metric will be aggregated over.
    tagName string
    Name of the tag that gets created.
    path str
    The path to the value the log-based metric will be aggregated over.
    tag_name str
    Name of the tag that gets created.
    path String
    The path to the value the log-based metric will be aggregated over.
    tagName String
    Name of the tag that gets created.

    Import

    $ pulumi import datadog:index/logsMetric:LogsMetric testing_logs_metric testing.logs.metric
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    Datadog pulumi/pulumi-datadog
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the datadog Terraform Provider.
    datadog logo
    Datadog v4.36.1 published on Friday, Nov 15, 2024 by Pulumi