Query

class Query : KotlinCustomResource

A Log Analytics QueryPack-Query definition. API Version: 2019-09-01.

Example Usage

QueryPut

using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;
return await Deployment.RunAsync(() =>
{
var query = new AzureNative.OperationalInsights.Query("query", new()
{
Body = @"let newExceptionsTimeRange = 1d;
let timeRangeToCheckBefore = 7d;
exceptions
| where timestamp < ago(timeRangeToCheckBefore)
| summarize count() by problemId
| join kind= rightanti (
exceptions
| where timestamp >= ago(newExceptionsTimeRange)
| extend stack = tostring(details[0].rawStack)
| summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId
) on problemId
| order by count_ desc
",
Description = "my description",
DisplayName = "Exceptions - New in the last 24 hours",
Id = "a449f8af-8e64-4b3a-9b16-5a7165ff98c4",
QueryPackName = "my-querypack",
Related = new AzureNative.OperationalInsights.Inputs.LogAnalyticsQueryPackQueryPropertiesRelatedArgs
{
Categories = new[]
{
"analytics",
},
},
ResourceGroupName = "my-resource-group",
Tags =
{
{ "my-label", new[]
{
"label1",
} },
{ "my-other-label", new[]
{
"label2",
} },
},
});
});
package main
import (
operationalinsights "github.com/pulumi/pulumi-azure-native-sdk/operationalinsights"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := operationalinsights.NewQuery(ctx, "query", &operationalinsights.QueryArgs{
Body: pulumi.String("let newExceptionsTimeRange = 1d;\nlet timeRangeToCheckBefore = 7d;\nexceptions\n| where timestamp < ago(timeRangeToCheckBefore)\n| summarize count() by problemId\n| join kind= rightanti (\nexceptions\n| where timestamp >= ago(newExceptionsTimeRange)\n| extend stack = tostring(details[0].rawStack)\n| summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId \n) on problemId \n| order by count_ desc\n"),
Description: pulumi.String("my description"),
DisplayName: pulumi.String("Exceptions - New in the last 24 hours"),
Id: pulumi.String("a449f8af-8e64-4b3a-9b16-5a7165ff98c4"),
QueryPackName: pulumi.String("my-querypack"),
Related: &operationalinsights.LogAnalyticsQueryPackQueryPropertiesRelatedArgs{
Categories: pulumi.StringArray{
pulumi.String("analytics"),
},
},
ResourceGroupName: pulumi.String("my-resource-group"),
Tags: pulumi.StringArrayMap{
"my-label": pulumi.StringArray{
pulumi.String("label1"),
},
"my-other-label": pulumi.StringArray{
pulumi.String("label2"),
},
},
})
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.azurenative.operationalinsights.Query;
import com.pulumi.azurenative.operationalinsights.QueryArgs;
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 query = new Query("query", QueryArgs.builder()
.body("""
let newExceptionsTimeRange = 1d;
let timeRangeToCheckBefore = 7d;
exceptions
| where timestamp < ago(timeRangeToCheckBefore)
| summarize count() by problemId
| join kind= rightanti (
exceptions
| where timestamp >= ago(newExceptionsTimeRange)
| extend stack = tostring(details[0].rawStack)
| summarize count(), dcount(user_AuthenticatedId), min(timestamp), max(timestamp), any(stack) by problemId
) on problemId
| order by count_ desc
""")
.description("my description")
.displayName("Exceptions - New in the last 24 hours")
.id("a449f8af-8e64-4b3a-9b16-5a7165ff98c4")
.queryPackName("my-querypack")
.related(Map.of("categories", "analytics"))
.resourceGroupName("my-resource-group")
.tags(Map.ofEntries(
Map.entry("my-label", "label1"),
Map.entry("my-other-label", "label2")
))
.build());
}
}

Import

An existing resource can be imported using its type token, name, and identifier, e.g.

$ pulumi import azure-native:operationalinsights:Query a449f8af-8e64-4b3a-9b16-5a7165ff98c4 /subscriptions/86dc51d3-92ed-4d7e-947a-775ea79b4918/resourceGroups/my-resource-group/providers/microsoft.operationalinsights/queryPacks/my-querypack/queries/a449f8af-8e64-4b3a-9b16-5a7165ff98c4

Properties

Link copied to clipboard
val author: Output<String>

Object Id of user creating the query.

Link copied to clipboard
val body: Output<String>

Body of the query.

Link copied to clipboard
val description: Output<String>?

Description of the query.

Link copied to clipboard
val displayName: Output<String>

Unique display name for your query within the Query Pack.

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val name: Output<String>

Azure resource name

Link copied to clipboard
val properties: Output<Any>

Additional properties that can be set for the query.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The related metadata items for the function.

Link copied to clipboard

Read only system data

Link copied to clipboard
val tags: Output<Map<String, List<String>>>?

Tags associated with the query.

Link copied to clipboard
val timeCreated: Output<String>

Creation Date for the Log Analytics Query, in ISO 8601 format.

Link copied to clipboard
val timeModified: Output<String>

Last modified date of the Log Analytics Query, in ISO 8601 format.

Link copied to clipboard
val type: Output<String>

Azure resource type

Link copied to clipboard
val urn: Output<String>