1. Packages
  2. Azure Classic
  3. API Docs
  4. loganalytics
  5. SavedSearch

We recommend using Azure Native.

Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi

azure.loganalytics.SavedSearch

Explore with Pulumi AI

azure logo

We recommend using Azure Native.

Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi

    Manages a Log Analytics (formally Operational Insights) Saved Search.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as azure from "@pulumi/azure";
    
    const example = new azure.core.ResourceGroup("example", {
        name: "example-resources",
        location: "West Europe",
    });
    const exampleAnalyticsWorkspace = new azure.operationalinsights.AnalyticsWorkspace("example", {
        name: "acctest-01",
        location: example.location,
        resourceGroupName: example.name,
        sku: "PerGB2018",
        retentionInDays: 30,
    });
    const exampleSavedSearch = new azure.loganalytics.SavedSearch("example", {
        name: "exampleSavedSearch",
        logAnalyticsWorkspaceId: exampleAnalyticsWorkspace.id,
        category: "exampleCategory",
        displayName: "exampleDisplayName",
        query: "exampleQuery",
    });
    
    import pulumi
    import pulumi_azure as azure
    
    example = azure.core.ResourceGroup("example",
        name="example-resources",
        location="West Europe")
    example_analytics_workspace = azure.operationalinsights.AnalyticsWorkspace("example",
        name="acctest-01",
        location=example.location,
        resource_group_name=example.name,
        sku="PerGB2018",
        retention_in_days=30)
    example_saved_search = azure.loganalytics.SavedSearch("example",
        name="exampleSavedSearch",
        log_analytics_workspace_id=example_analytics_workspace.id,
        category="exampleCategory",
        display_name="exampleDisplayName",
        query="exampleQuery")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/core"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/loganalytics"
    	"github.com/pulumi/pulumi-azure/sdk/v5/go/azure/operationalinsights"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		example, err := core.NewResourceGroup(ctx, "example", &core.ResourceGroupArgs{
    			Name:     pulumi.String("example-resources"),
    			Location: pulumi.String("West Europe"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleAnalyticsWorkspace, err := operationalinsights.NewAnalyticsWorkspace(ctx, "example", &operationalinsights.AnalyticsWorkspaceArgs{
    			Name:              pulumi.String("acctest-01"),
    			Location:          example.Location,
    			ResourceGroupName: example.Name,
    			Sku:               pulumi.String("PerGB2018"),
    			RetentionInDays:   pulumi.Int(30),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = loganalytics.NewSavedSearch(ctx, "example", &loganalytics.SavedSearchArgs{
    			Name:                    pulumi.String("exampleSavedSearch"),
    			LogAnalyticsWorkspaceId: exampleAnalyticsWorkspace.ID(),
    			Category:                pulumi.String("exampleCategory"),
    			DisplayName:             pulumi.String("exampleDisplayName"),
    			Query:                   pulumi.String("exampleQuery"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Azure = Pulumi.Azure;
    
    return await Deployment.RunAsync(() => 
    {
        var example = new Azure.Core.ResourceGroup("example", new()
        {
            Name = "example-resources",
            Location = "West Europe",
        });
    
        var exampleAnalyticsWorkspace = new Azure.OperationalInsights.AnalyticsWorkspace("example", new()
        {
            Name = "acctest-01",
            Location = example.Location,
            ResourceGroupName = example.Name,
            Sku = "PerGB2018",
            RetentionInDays = 30,
        });
    
        var exampleSavedSearch = new Azure.LogAnalytics.SavedSearch("example", new()
        {
            Name = "exampleSavedSearch",
            LogAnalyticsWorkspaceId = exampleAnalyticsWorkspace.Id,
            Category = "exampleCategory",
            DisplayName = "exampleDisplayName",
            Query = "exampleQuery",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.azure.core.ResourceGroup;
    import com.pulumi.azure.core.ResourceGroupArgs;
    import com.pulumi.azure.operationalinsights.AnalyticsWorkspace;
    import com.pulumi.azure.operationalinsights.AnalyticsWorkspaceArgs;
    import com.pulumi.azure.loganalytics.SavedSearch;
    import com.pulumi.azure.loganalytics.SavedSearchArgs;
    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 example = new ResourceGroup("example", ResourceGroupArgs.builder()
                .name("example-resources")
                .location("West Europe")
                .build());
    
            var exampleAnalyticsWorkspace = new AnalyticsWorkspace("exampleAnalyticsWorkspace", AnalyticsWorkspaceArgs.builder()
                .name("acctest-01")
                .location(example.location())
                .resourceGroupName(example.name())
                .sku("PerGB2018")
                .retentionInDays(30)
                .build());
    
            var exampleSavedSearch = new SavedSearch("exampleSavedSearch", SavedSearchArgs.builder()
                .name("exampleSavedSearch")
                .logAnalyticsWorkspaceId(exampleAnalyticsWorkspace.id())
                .category("exampleCategory")
                .displayName("exampleDisplayName")
                .query("exampleQuery")
                .build());
    
        }
    }
    
    resources:
      example:
        type: azure:core:ResourceGroup
        properties:
          name: example-resources
          location: West Europe
      exampleAnalyticsWorkspace:
        type: azure:operationalinsights:AnalyticsWorkspace
        name: example
        properties:
          name: acctest-01
          location: ${example.location}
          resourceGroupName: ${example.name}
          sku: PerGB2018
          retentionInDays: 30
      exampleSavedSearch:
        type: azure:loganalytics:SavedSearch
        name: example
        properties:
          name: exampleSavedSearch
          logAnalyticsWorkspaceId: ${exampleAnalyticsWorkspace.id}
          category: exampleCategory
          displayName: exampleDisplayName
          query: exampleQuery
    

    Create SavedSearch Resource

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

    Constructor syntax

    new SavedSearch(name: string, args: SavedSearchArgs, opts?: CustomResourceOptions);
    @overload
    def SavedSearch(resource_name: str,
                    args: SavedSearchArgs,
                    opts: Optional[ResourceOptions] = None)
    
    @overload
    def SavedSearch(resource_name: str,
                    opts: Optional[ResourceOptions] = None,
                    category: Optional[str] = None,
                    display_name: Optional[str] = None,
                    log_analytics_workspace_id: Optional[str] = None,
                    query: Optional[str] = None,
                    function_alias: Optional[str] = None,
                    function_parameters: Optional[Sequence[str]] = None,
                    name: Optional[str] = None,
                    tags: Optional[Mapping[str, str]] = None)
    func NewSavedSearch(ctx *Context, name string, args SavedSearchArgs, opts ...ResourceOption) (*SavedSearch, error)
    public SavedSearch(string name, SavedSearchArgs args, CustomResourceOptions? opts = null)
    public SavedSearch(String name, SavedSearchArgs args)
    public SavedSearch(String name, SavedSearchArgs args, CustomResourceOptions options)
    
    type: azure:loganalytics:SavedSearch
    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 SavedSearchArgs
    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 SavedSearchArgs
    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 SavedSearchArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SavedSearchArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SavedSearchArgs
    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 savedSearchResource = new Azure.LogAnalytics.SavedSearch("savedSearchResource", new()
    {
        Category = "string",
        DisplayName = "string",
        LogAnalyticsWorkspaceId = "string",
        Query = "string",
        FunctionAlias = "string",
        FunctionParameters = new[]
        {
            "string",
        },
        Name = "string",
        Tags = 
        {
            { "string", "string" },
        },
    });
    
    example, err := loganalytics.NewSavedSearch(ctx, "savedSearchResource", &loganalytics.SavedSearchArgs{
    	Category:                pulumi.String("string"),
    	DisplayName:             pulumi.String("string"),
    	LogAnalyticsWorkspaceId: pulumi.String("string"),
    	Query:                   pulumi.String("string"),
    	FunctionAlias:           pulumi.String("string"),
    	FunctionParameters: pulumi.StringArray{
    		pulumi.String("string"),
    	},
    	Name: pulumi.String("string"),
    	Tags: pulumi.StringMap{
    		"string": pulumi.String("string"),
    	},
    })
    
    var savedSearchResource = new SavedSearch("savedSearchResource", SavedSearchArgs.builder()
        .category("string")
        .displayName("string")
        .logAnalyticsWorkspaceId("string")
        .query("string")
        .functionAlias("string")
        .functionParameters("string")
        .name("string")
        .tags(Map.of("string", "string"))
        .build());
    
    saved_search_resource = azure.loganalytics.SavedSearch("savedSearchResource",
        category="string",
        display_name="string",
        log_analytics_workspace_id="string",
        query="string",
        function_alias="string",
        function_parameters=["string"],
        name="string",
        tags={
            "string": "string",
        })
    
    const savedSearchResource = new azure.loganalytics.SavedSearch("savedSearchResource", {
        category: "string",
        displayName: "string",
        logAnalyticsWorkspaceId: "string",
        query: "string",
        functionAlias: "string",
        functionParameters: ["string"],
        name: "string",
        tags: {
            string: "string",
        },
    });
    
    type: azure:loganalytics:SavedSearch
    properties:
        category: string
        displayName: string
        functionAlias: string
        functionParameters:
            - string
        logAnalyticsWorkspaceId: string
        name: string
        query: string
        tags:
            string: string
    

    SavedSearch 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 SavedSearch resource accepts the following input properties:

    Category string
    The category that the Saved Search will be listed under. Changing this forces a new resource to be created.
    DisplayName string
    The name that Saved Search will be displayed as. Changing this forces a new resource to be created.
    LogAnalyticsWorkspaceId string
    Specifies the ID of the Log Analytics Workspace that the Saved Search will be associated with. Changing this forces a new resource to be created.
    Query string
    The query expression for the saved search. Changing this forces a new resource to be created.
    FunctionAlias string
    The function alias if the query serves as a function. Changing this forces a new resource to be created.
    FunctionParameters List<string>
    The function parameters if the query serves as a function. Changing this forces a new resource to be created.
    Name string
    Specifies the name of the Log Analytics Saved Search. Changing this forces a new resource to be created.
    Tags Dictionary<string, string>
    A mapping of tags which should be assigned to the Logs Analytics Saved Search. Changing this forces a new resource to be created.
    Category string
    The category that the Saved Search will be listed under. Changing this forces a new resource to be created.
    DisplayName string
    The name that Saved Search will be displayed as. Changing this forces a new resource to be created.
    LogAnalyticsWorkspaceId string
    Specifies the ID of the Log Analytics Workspace that the Saved Search will be associated with. Changing this forces a new resource to be created.
    Query string
    The query expression for the saved search. Changing this forces a new resource to be created.
    FunctionAlias string
    The function alias if the query serves as a function. Changing this forces a new resource to be created.
    FunctionParameters []string
    The function parameters if the query serves as a function. Changing this forces a new resource to be created.
    Name string
    Specifies the name of the Log Analytics Saved Search. Changing this forces a new resource to be created.
    Tags map[string]string
    A mapping of tags which should be assigned to the Logs Analytics Saved Search. Changing this forces a new resource to be created.
    category String
    The category that the Saved Search will be listed under. Changing this forces a new resource to be created.
    displayName String
    The name that Saved Search will be displayed as. Changing this forces a new resource to be created.
    logAnalyticsWorkspaceId String
    Specifies the ID of the Log Analytics Workspace that the Saved Search will be associated with. Changing this forces a new resource to be created.
    query String
    The query expression for the saved search. Changing this forces a new resource to be created.
    functionAlias String
    The function alias if the query serves as a function. Changing this forces a new resource to be created.
    functionParameters List<String>
    The function parameters if the query serves as a function. Changing this forces a new resource to be created.
    name String
    Specifies the name of the Log Analytics Saved Search. Changing this forces a new resource to be created.
    tags Map<String,String>
    A mapping of tags which should be assigned to the Logs Analytics Saved Search. Changing this forces a new resource to be created.
    category string
    The category that the Saved Search will be listed under. Changing this forces a new resource to be created.
    displayName string
    The name that Saved Search will be displayed as. Changing this forces a new resource to be created.
    logAnalyticsWorkspaceId string
    Specifies the ID of the Log Analytics Workspace that the Saved Search will be associated with. Changing this forces a new resource to be created.
    query string
    The query expression for the saved search. Changing this forces a new resource to be created.
    functionAlias string
    The function alias if the query serves as a function. Changing this forces a new resource to be created.
    functionParameters string[]
    The function parameters if the query serves as a function. Changing this forces a new resource to be created.
    name string
    Specifies the name of the Log Analytics Saved Search. Changing this forces a new resource to be created.
    tags {[key: string]: string}
    A mapping of tags which should be assigned to the Logs Analytics Saved Search. Changing this forces a new resource to be created.
    category str
    The category that the Saved Search will be listed under. Changing this forces a new resource to be created.
    display_name str
    The name that Saved Search will be displayed as. Changing this forces a new resource to be created.
    log_analytics_workspace_id str
    Specifies the ID of the Log Analytics Workspace that the Saved Search will be associated with. Changing this forces a new resource to be created.
    query str
    The query expression for the saved search. Changing this forces a new resource to be created.
    function_alias str
    The function alias if the query serves as a function. Changing this forces a new resource to be created.
    function_parameters Sequence[str]
    The function parameters if the query serves as a function. Changing this forces a new resource to be created.
    name str
    Specifies the name of the Log Analytics Saved Search. Changing this forces a new resource to be created.
    tags Mapping[str, str]
    A mapping of tags which should be assigned to the Logs Analytics Saved Search. Changing this forces a new resource to be created.
    category String
    The category that the Saved Search will be listed under. Changing this forces a new resource to be created.
    displayName String
    The name that Saved Search will be displayed as. Changing this forces a new resource to be created.
    logAnalyticsWorkspaceId String
    Specifies the ID of the Log Analytics Workspace that the Saved Search will be associated with. Changing this forces a new resource to be created.
    query String
    The query expression for the saved search. Changing this forces a new resource to be created.
    functionAlias String
    The function alias if the query serves as a function. Changing this forces a new resource to be created.
    functionParameters List<String>
    The function parameters if the query serves as a function. Changing this forces a new resource to be created.
    name String
    Specifies the name of the Log Analytics Saved Search. Changing this forces a new resource to be created.
    tags Map<String>
    A mapping of tags which should be assigned to the Logs Analytics Saved Search. Changing this forces a new resource to be created.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the SavedSearch 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 SavedSearch Resource

    Get an existing SavedSearch 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?: SavedSearchState, opts?: CustomResourceOptions): SavedSearch
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            category: Optional[str] = None,
            display_name: Optional[str] = None,
            function_alias: Optional[str] = None,
            function_parameters: Optional[Sequence[str]] = None,
            log_analytics_workspace_id: Optional[str] = None,
            name: Optional[str] = None,
            query: Optional[str] = None,
            tags: Optional[Mapping[str, str]] = None) -> SavedSearch
    func GetSavedSearch(ctx *Context, name string, id IDInput, state *SavedSearchState, opts ...ResourceOption) (*SavedSearch, error)
    public static SavedSearch Get(string name, Input<string> id, SavedSearchState? state, CustomResourceOptions? opts = null)
    public static SavedSearch get(String name, Output<String> id, SavedSearchState 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:
    Category string
    The category that the Saved Search will be listed under. Changing this forces a new resource to be created.
    DisplayName string
    The name that Saved Search will be displayed as. Changing this forces a new resource to be created.
    FunctionAlias string
    The function alias if the query serves as a function. Changing this forces a new resource to be created.
    FunctionParameters List<string>
    The function parameters if the query serves as a function. Changing this forces a new resource to be created.
    LogAnalyticsWorkspaceId string
    Specifies the ID of the Log Analytics Workspace that the Saved Search will be associated with. Changing this forces a new resource to be created.
    Name string
    Specifies the name of the Log Analytics Saved Search. Changing this forces a new resource to be created.
    Query string
    The query expression for the saved search. Changing this forces a new resource to be created.
    Tags Dictionary<string, string>
    A mapping of tags which should be assigned to the Logs Analytics Saved Search. Changing this forces a new resource to be created.
    Category string
    The category that the Saved Search will be listed under. Changing this forces a new resource to be created.
    DisplayName string
    The name that Saved Search will be displayed as. Changing this forces a new resource to be created.
    FunctionAlias string
    The function alias if the query serves as a function. Changing this forces a new resource to be created.
    FunctionParameters []string
    The function parameters if the query serves as a function. Changing this forces a new resource to be created.
    LogAnalyticsWorkspaceId string
    Specifies the ID of the Log Analytics Workspace that the Saved Search will be associated with. Changing this forces a new resource to be created.
    Name string
    Specifies the name of the Log Analytics Saved Search. Changing this forces a new resource to be created.
    Query string
    The query expression for the saved search. Changing this forces a new resource to be created.
    Tags map[string]string
    A mapping of tags which should be assigned to the Logs Analytics Saved Search. Changing this forces a new resource to be created.
    category String
    The category that the Saved Search will be listed under. Changing this forces a new resource to be created.
    displayName String
    The name that Saved Search will be displayed as. Changing this forces a new resource to be created.
    functionAlias String
    The function alias if the query serves as a function. Changing this forces a new resource to be created.
    functionParameters List<String>
    The function parameters if the query serves as a function. Changing this forces a new resource to be created.
    logAnalyticsWorkspaceId String
    Specifies the ID of the Log Analytics Workspace that the Saved Search will be associated with. Changing this forces a new resource to be created.
    name String
    Specifies the name of the Log Analytics Saved Search. Changing this forces a new resource to be created.
    query String
    The query expression for the saved search. Changing this forces a new resource to be created.
    tags Map<String,String>
    A mapping of tags which should be assigned to the Logs Analytics Saved Search. Changing this forces a new resource to be created.
    category string
    The category that the Saved Search will be listed under. Changing this forces a new resource to be created.
    displayName string
    The name that Saved Search will be displayed as. Changing this forces a new resource to be created.
    functionAlias string
    The function alias if the query serves as a function. Changing this forces a new resource to be created.
    functionParameters string[]
    The function parameters if the query serves as a function. Changing this forces a new resource to be created.
    logAnalyticsWorkspaceId string
    Specifies the ID of the Log Analytics Workspace that the Saved Search will be associated with. Changing this forces a new resource to be created.
    name string
    Specifies the name of the Log Analytics Saved Search. Changing this forces a new resource to be created.
    query string
    The query expression for the saved search. Changing this forces a new resource to be created.
    tags {[key: string]: string}
    A mapping of tags which should be assigned to the Logs Analytics Saved Search. Changing this forces a new resource to be created.
    category str
    The category that the Saved Search will be listed under. Changing this forces a new resource to be created.
    display_name str
    The name that Saved Search will be displayed as. Changing this forces a new resource to be created.
    function_alias str
    The function alias if the query serves as a function. Changing this forces a new resource to be created.
    function_parameters Sequence[str]
    The function parameters if the query serves as a function. Changing this forces a new resource to be created.
    log_analytics_workspace_id str
    Specifies the ID of the Log Analytics Workspace that the Saved Search will be associated with. Changing this forces a new resource to be created.
    name str
    Specifies the name of the Log Analytics Saved Search. Changing this forces a new resource to be created.
    query str
    The query expression for the saved search. Changing this forces a new resource to be created.
    tags Mapping[str, str]
    A mapping of tags which should be assigned to the Logs Analytics Saved Search. Changing this forces a new resource to be created.
    category String
    The category that the Saved Search will be listed under. Changing this forces a new resource to be created.
    displayName String
    The name that Saved Search will be displayed as. Changing this forces a new resource to be created.
    functionAlias String
    The function alias if the query serves as a function. Changing this forces a new resource to be created.
    functionParameters List<String>
    The function parameters if the query serves as a function. Changing this forces a new resource to be created.
    logAnalyticsWorkspaceId String
    Specifies the ID of the Log Analytics Workspace that the Saved Search will be associated with. Changing this forces a new resource to be created.
    name String
    Specifies the name of the Log Analytics Saved Search. Changing this forces a new resource to be created.
    query String
    The query expression for the saved search. Changing this forces a new resource to be created.
    tags Map<String>
    A mapping of tags which should be assigned to the Logs Analytics Saved Search. Changing this forces a new resource to be created.

    Import

    Log Analytics Saved Searches can be imported using the resource id, e.g.

    $ pulumi import azure:loganalytics/savedSearch:SavedSearch search1 /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.OperationalInsights/workspaces/workspace1/savedSearches/search1
    

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

    Package Details

    Repository
    Azure Classic pulumi/pulumi-azure
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azurerm Terraform Provider.
    azure logo

    We recommend using Azure Native.

    Azure Classic v5.81.0 published on Monday, Jun 24, 2024 by Pulumi