azure-native.operationalinsights.Query
Explore with Pulumi AI
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 pulumi
import pulumi_azure_native as azure_native
query = azure_native.operationalinsights.Query("query",
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",
display_name="Exceptions - New in the last 24 hours",
id="a449f8af-8e64-4b3a-9b16-5a7165ff98c4",
query_pack_name="my-querypack",
related=azure_native.operationalinsights.LogAnalyticsQueryPackQueryPropertiesRelatedArgs(
categories=["analytics"],
),
resource_group_name="my-resource-group",
tags={
"my-label": ["label1"],
"my-other-label": ["label2"],
})
import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";
const query = new azure_native.operationalinsights.Query("query", {
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: {
categories: ["analytics"],
},
resourceGroupName: "my-resource-group",
tags: {
"my-label": ["label1"],
"my-other-label": ["label2"],
},
});
resources:
query:
type: azure-native:operationalinsights:Query
properties:
body: "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: my description
displayName: Exceptions - New in the last 24 hours
id: a449f8af-8e64-4b3a-9b16-5a7165ff98c4
queryPackName: my-querypack
related:
categories:
- analytics
resourceGroupName: my-resource-group
tags:
my-label:
- label1
my-other-label:
- label2
Create Query Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new Query(name: string, args: QueryArgs, opts?: CustomResourceOptions);
@overload
def Query(resource_name: str,
args: QueryArgs,
opts: Optional[ResourceOptions] = None)
@overload
def Query(resource_name: str,
opts: Optional[ResourceOptions] = None,
body: Optional[str] = None,
display_name: Optional[str] = None,
query_pack_name: Optional[str] = None,
resource_group_name: Optional[str] = None,
description: Optional[str] = None,
id: Optional[str] = None,
properties: Optional[Any] = None,
related: Optional[LogAnalyticsQueryPackQueryPropertiesRelatedArgs] = None,
tags: Optional[Mapping[str, Sequence[str]]] = None)
func NewQuery(ctx *Context, name string, args QueryArgs, opts ...ResourceOption) (*Query, error)
public Query(string name, QueryArgs args, CustomResourceOptions? opts = null)
type: azure-native:operationalinsights:Query
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 QueryArgs
- 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 QueryArgs
- 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 QueryArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args QueryArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args QueryArgs
- 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 queryResource = new AzureNative.Operationalinsights.Query("queryResource", new()
{
Body = "string",
DisplayName = "string",
QueryPackName = "string",
ResourceGroupName = "string",
Description = "string",
Id = "string",
Properties = "any",
Related =
{
{ "categories", new[]
{
"string",
} },
{ "resourceTypes", new[]
{
"string",
} },
{ "solutions", new[]
{
"string",
} },
},
Tags =
{
{ "string", new[]
{
"string",
} },
},
});
example, err := operationalinsights.NewQuery(ctx, "queryResource", &operationalinsights.QueryArgs{
Body: "string",
DisplayName: "string",
QueryPackName: "string",
ResourceGroupName: "string",
Description: "string",
Id: "string",
Properties: "any",
Related: map[string]interface{}{
"categories": []string{
"string",
},
"resourceTypes": []string{
"string",
},
"solutions": []string{
"string",
},
},
Tags: map[string]interface{}{
"string": []string{
"string",
},
},
})
var queryResource = new Query("queryResource", QueryArgs.builder()
.body("string")
.displayName("string")
.queryPackName("string")
.resourceGroupName("string")
.description("string")
.id("string")
.properties("any")
.related(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
.tags(%!v(PANIC=Format method: runtime error: invalid memory address or nil pointer dereference))
.build());
query_resource = azure_native.operationalinsights.Query("queryResource",
body=string,
display_name=string,
query_pack_name=string,
resource_group_name=string,
description=string,
id=string,
properties=any,
related={
categories: [string],
resourceTypes: [string],
solutions: [string],
},
tags={
string: [string],
})
const queryResource = new azure_native.operationalinsights.Query("queryResource", {
body: "string",
displayName: "string",
queryPackName: "string",
resourceGroupName: "string",
description: "string",
id: "string",
properties: "any",
related: {
categories: ["string"],
resourceTypes: ["string"],
solutions: ["string"],
},
tags: {
string: ["string"],
},
});
type: azure-native:operationalinsights:Query
properties:
body: string
description: string
displayName: string
id: string
properties: any
queryPackName: string
related:
categories:
- string
resourceTypes:
- string
solutions:
- string
resourceGroupName: string
tags:
string:
- string
Query 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 Query resource accepts the following input properties:
- Body string
- Body of the query.
- Display
Name string - Unique display name for your query within the Query Pack.
- Query
Pack stringName - The name of the Log Analytics QueryPack resource.
- Resource
Group stringName - The name of the resource group. The name is case insensitive.
- Description string
- Description of the query.
- Id string
- The id of a specific query defined in the Log Analytics QueryPack
- Properties object
- Additional properties that can be set for the query.
- Pulumi.
Azure Native. Operational Insights. Inputs. Log Analytics Query Pack Query Properties Related - The related metadata items for the function.
- Dictionary<string, Immutable
Array<string>> - Tags associated with the query.
- Body string
- Body of the query.
- Display
Name string - Unique display name for your query within the Query Pack.
- Query
Pack stringName - The name of the Log Analytics QueryPack resource.
- Resource
Group stringName - The name of the resource group. The name is case insensitive.
- Description string
- Description of the query.
- Id string
- The id of a specific query defined in the Log Analytics QueryPack
- Properties interface{}
- Additional properties that can be set for the query.
- Log
Analytics Query Pack Query Properties Related Args - The related metadata items for the function.
- map[string][]string
- Tags associated with the query.
- body String
- Body of the query.
- display
Name String - Unique display name for your query within the Query Pack.
- query
Pack StringName - The name of the Log Analytics QueryPack resource.
- resource
Group StringName - The name of the resource group. The name is case insensitive.
- description String
- Description of the query.
- id String
- The id of a specific query defined in the Log Analytics QueryPack
- properties Object
- Additional properties that can be set for the query.
- Log
Analytics Query Pack Query Properties Related - The related metadata items for the function.
- Map<String,List<String>>
- Tags associated with the query.
- body string
- Body of the query.
- display
Name string - Unique display name for your query within the Query Pack.
- query
Pack stringName - The name of the Log Analytics QueryPack resource.
- resource
Group stringName - The name of the resource group. The name is case insensitive.
- description string
- Description of the query.
- id string
- The id of a specific query defined in the Log Analytics QueryPack
- properties any
- Additional properties that can be set for the query.
- Log
Analytics Query Pack Query Properties Related - The related metadata items for the function.
- {[key: string]: string[]}
- Tags associated with the query.
- body str
- Body of the query.
- display_
name str - Unique display name for your query within the Query Pack.
- query_
pack_ strname - The name of the Log Analytics QueryPack resource.
- resource_
group_ strname - The name of the resource group. The name is case insensitive.
- description str
- Description of the query.
- id str
- The id of a specific query defined in the Log Analytics QueryPack
- properties Any
- Additional properties that can be set for the query.
- Log
Analytics Query Pack Query Properties Related Args - The related metadata items for the function.
- Mapping[str, Sequence[str]]
- Tags associated with the query.
- body String
- Body of the query.
- display
Name String - Unique display name for your query within the Query Pack.
- query
Pack StringName - The name of the Log Analytics QueryPack resource.
- resource
Group StringName - The name of the resource group. The name is case insensitive.
- description String
- Description of the query.
- id String
- The id of a specific query defined in the Log Analytics QueryPack
- properties Any
- Additional properties that can be set for the query.
- Property Map
- The related metadata items for the function.
- Map<List<String>>
- Tags associated with the query.
Outputs
All input properties are implicitly available as output properties. Additionally, the Query resource produces the following output properties:
- string
- Object Id of user creating the query.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- Azure resource name
- System
Data Pulumi.Azure Native. Operational Insights. Outputs. System Data Response - Read only system data
- Time
Created string - Creation Date for the Log Analytics Query, in ISO 8601 format.
- Time
Modified string - Last modified date of the Log Analytics Query, in ISO 8601 format.
- Type string
- Azure resource type
- string
- Object Id of user creating the query.
- Id string
- The provider-assigned unique ID for this managed resource.
- Name string
- Azure resource name
- System
Data SystemData Response - Read only system data
- Time
Created string - Creation Date for the Log Analytics Query, in ISO 8601 format.
- Time
Modified string - Last modified date of the Log Analytics Query, in ISO 8601 format.
- Type string
- Azure resource type
- String
- Object Id of user creating the query.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- Azure resource name
- system
Data SystemData Response - Read only system data
- time
Created String - Creation Date for the Log Analytics Query, in ISO 8601 format.
- time
Modified String - Last modified date of the Log Analytics Query, in ISO 8601 format.
- type String
- Azure resource type
- string
- Object Id of user creating the query.
- id string
- The provider-assigned unique ID for this managed resource.
- name string
- Azure resource name
- system
Data SystemData Response - Read only system data
- time
Created string - Creation Date for the Log Analytics Query, in ISO 8601 format.
- time
Modified string - Last modified date of the Log Analytics Query, in ISO 8601 format.
- type string
- Azure resource type
- str
- Object Id of user creating the query.
- id str
- The provider-assigned unique ID for this managed resource.
- name str
- Azure resource name
- system_
data SystemData Response - Read only system data
- time_
created str - Creation Date for the Log Analytics Query, in ISO 8601 format.
- time_
modified str - Last modified date of the Log Analytics Query, in ISO 8601 format.
- type str
- Azure resource type
- String
- Object Id of user creating the query.
- id String
- The provider-assigned unique ID for this managed resource.
- name String
- Azure resource name
- system
Data Property Map - Read only system data
- time
Created String - Creation Date for the Log Analytics Query, in ISO 8601 format.
- time
Modified String - Last modified date of the Log Analytics Query, in ISO 8601 format.
- type String
- Azure resource type
Supporting Types
LogAnalyticsQueryPackQueryPropertiesRelated, LogAnalyticsQueryPackQueryPropertiesRelatedArgs
- Categories List<string>
- The related categories for the function.
- Resource
Types List<string> - The related resource types for the function.
- Solutions List<string>
- The related Log Analytics solutions for the function.
- Categories []string
- The related categories for the function.
- Resource
Types []string - The related resource types for the function.
- Solutions []string
- The related Log Analytics solutions for the function.
- categories List<String>
- The related categories for the function.
- resource
Types List<String> - The related resource types for the function.
- solutions List<String>
- The related Log Analytics solutions for the function.
- categories string[]
- The related categories for the function.
- resource
Types string[] - The related resource types for the function.
- solutions string[]
- The related Log Analytics solutions for the function.
- categories Sequence[str]
- The related categories for the function.
- resource_
types Sequence[str] - The related resource types for the function.
- solutions Sequence[str]
- The related Log Analytics solutions for the function.
- categories List<String>
- The related categories for the function.
- resource
Types List<String> - The related resource types for the function.
- solutions List<String>
- The related Log Analytics solutions for the function.
LogAnalyticsQueryPackQueryPropertiesResponseRelated, LogAnalyticsQueryPackQueryPropertiesResponseRelatedArgs
- Categories List<string>
- The related categories for the function.
- Resource
Types List<string> - The related resource types for the function.
- Solutions List<string>
- The related Log Analytics solutions for the function.
- Categories []string
- The related categories for the function.
- Resource
Types []string - The related resource types for the function.
- Solutions []string
- The related Log Analytics solutions for the function.
- categories List<String>
- The related categories for the function.
- resource
Types List<String> - The related resource types for the function.
- solutions List<String>
- The related Log Analytics solutions for the function.
- categories string[]
- The related categories for the function.
- resource
Types string[] - The related resource types for the function.
- solutions string[]
- The related Log Analytics solutions for the function.
- categories Sequence[str]
- The related categories for the function.
- resource_
types Sequence[str] - The related resource types for the function.
- solutions Sequence[str]
- The related Log Analytics solutions for the function.
- categories List<String>
- The related categories for the function.
- resource
Types List<String> - The related resource types for the function.
- solutions List<String>
- The related Log Analytics solutions for the function.
SystemDataResponse, SystemDataResponseArgs
- Created
At string - The timestamp of resource creation (UTC).
- Created
By string - The identity that created the resource.
- Created
By stringType - The type of identity that created the resource.
- Last
Modified stringAt - The timestamp of resource last modification (UTC)
- Last
Modified stringBy - The identity that last modified the resource.
- Last
Modified stringBy Type - The type of identity that last modified the resource.
- Created
At string - The timestamp of resource creation (UTC).
- Created
By string - The identity that created the resource.
- Created
By stringType - The type of identity that created the resource.
- Last
Modified stringAt - The timestamp of resource last modification (UTC)
- Last
Modified stringBy - The identity that last modified the resource.
- Last
Modified stringBy Type - The type of identity that last modified the resource.
- created
At String - The timestamp of resource creation (UTC).
- created
By String - The identity that created the resource.
- created
By StringType - The type of identity that created the resource.
- last
Modified StringAt - The timestamp of resource last modification (UTC)
- last
Modified StringBy - The identity that last modified the resource.
- last
Modified StringBy Type - The type of identity that last modified the resource.
- created
At string - The timestamp of resource creation (UTC).
- created
By string - The identity that created the resource.
- created
By stringType - The type of identity that created the resource.
- last
Modified stringAt - The timestamp of resource last modification (UTC)
- last
Modified stringBy - The identity that last modified the resource.
- last
Modified stringBy Type - The type of identity that last modified the resource.
- created_
at str - The timestamp of resource creation (UTC).
- created_
by str - The identity that created the resource.
- created_
by_ strtype - The type of identity that created the resource.
- last_
modified_ strat - The timestamp of resource last modification (UTC)
- last_
modified_ strby - The identity that last modified the resource.
- last_
modified_ strby_ type - The type of identity that last modified the resource.
- created
At String - The timestamp of resource creation (UTC).
- created
By String - The identity that created the resource.
- created
By StringType - The type of identity that created the resource.
- last
Modified StringAt - The timestamp of resource last modification (UTC)
- last
Modified StringBy - The identity that last modified the resource.
- last
Modified StringBy Type - The type of identity that last modified the resource.
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
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- azure-native-v1 pulumi/pulumi-azure-native
- License
- Apache-2.0