1. Packages
  2. Google Cloud (GCP) Classic
  3. API Docs
  4. logging
  5. SavedQuery
Viewing docs for Google Cloud v9.15.0
published on Thursday, Mar 12, 2026 by Pulumi
gcp logo
Viewing docs for Google Cloud v9.15.0
published on Thursday, Mar 12, 2026 by Pulumi

    Describes a query that has been saved by a user.

    To get more information about SavedQuery, see:

    Example Usage

    Logging Saved Query Basic

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const savedQuery = new gcp.logging.SavedQuery("saved_query", {
        name: "my-saved-query",
        displayName: "My Saved Query",
        parent: "projects/my-project-name",
        location: "global",
        description: "A saved query",
        loggingQuery: {
            filter: "resource.type=gce_instance",
        },
        visibility: "SHARED",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    saved_query = gcp.logging.SavedQuery("saved_query",
        name="my-saved-query",
        display_name="My Saved Query",
        parent="projects/my-project-name",
        location="global",
        description="A saved query",
        logging_query={
            "filter": "resource.type=gce_instance",
        },
        visibility="SHARED")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/logging"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := logging.NewSavedQuery(ctx, "saved_query", &logging.SavedQueryArgs{
    			Name:        pulumi.String("my-saved-query"),
    			DisplayName: pulumi.String("My Saved Query"),
    			Parent:      pulumi.String("projects/my-project-name"),
    			Location:    pulumi.String("global"),
    			Description: pulumi.String("A saved query"),
    			LoggingQuery: &logging.SavedQueryLoggingQueryArgs{
    				Filter: pulumi.String("resource.type=gce_instance"),
    			},
    			Visibility: pulumi.String("SHARED"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var savedQuery = new Gcp.Logging.SavedQuery("saved_query", new()
        {
            Name = "my-saved-query",
            DisplayName = "My Saved Query",
            Parent = "projects/my-project-name",
            Location = "global",
            Description = "A saved query",
            LoggingQuery = new Gcp.Logging.Inputs.SavedQueryLoggingQueryArgs
            {
                Filter = "resource.type=gce_instance",
            },
            Visibility = "SHARED",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.logging.SavedQuery;
    import com.pulumi.gcp.logging.SavedQueryArgs;
    import com.pulumi.gcp.logging.inputs.SavedQueryLoggingQueryArgs;
    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 savedQuery = new SavedQuery("savedQuery", SavedQueryArgs.builder()
                .name("my-saved-query")
                .displayName("My Saved Query")
                .parent("projects/my-project-name")
                .location("global")
                .description("A saved query")
                .loggingQuery(SavedQueryLoggingQueryArgs.builder()
                    .filter("resource.type=gce_instance")
                    .build())
                .visibility("SHARED")
                .build());
    
        }
    }
    
    resources:
      savedQuery:
        type: gcp:logging:SavedQuery
        name: saved_query
        properties:
          name: my-saved-query
          displayName: My Saved Query
          parent: projects/my-project-name
          location: global
          description: A saved query
          loggingQuery:
            filter: resource.type=gce_instance
          visibility: SHARED
    

    Logging Saved Query Private

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const savedQuery = new gcp.logging.SavedQuery("saved_query", {
        name: "my-saved-query-private",
        displayName: "My Saved Query",
        parent: "projects/my-project-name",
        location: "global",
        description: "A saved query",
        loggingQuery: {
            filter: "resource.type=gce_instance",
        },
        visibility: "PRIVATE",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    saved_query = gcp.logging.SavedQuery("saved_query",
        name="my-saved-query-private",
        display_name="My Saved Query",
        parent="projects/my-project-name",
        location="global",
        description="A saved query",
        logging_query={
            "filter": "resource.type=gce_instance",
        },
        visibility="PRIVATE")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/logging"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := logging.NewSavedQuery(ctx, "saved_query", &logging.SavedQueryArgs{
    			Name:        pulumi.String("my-saved-query-private"),
    			DisplayName: pulumi.String("My Saved Query"),
    			Parent:      pulumi.String("projects/my-project-name"),
    			Location:    pulumi.String("global"),
    			Description: pulumi.String("A saved query"),
    			LoggingQuery: &logging.SavedQueryLoggingQueryArgs{
    				Filter: pulumi.String("resource.type=gce_instance"),
    			},
    			Visibility: pulumi.String("PRIVATE"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var savedQuery = new Gcp.Logging.SavedQuery("saved_query", new()
        {
            Name = "my-saved-query-private",
            DisplayName = "My Saved Query",
            Parent = "projects/my-project-name",
            Location = "global",
            Description = "A saved query",
            LoggingQuery = new Gcp.Logging.Inputs.SavedQueryLoggingQueryArgs
            {
                Filter = "resource.type=gce_instance",
            },
            Visibility = "PRIVATE",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.logging.SavedQuery;
    import com.pulumi.gcp.logging.SavedQueryArgs;
    import com.pulumi.gcp.logging.inputs.SavedQueryLoggingQueryArgs;
    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 savedQuery = new SavedQuery("savedQuery", SavedQueryArgs.builder()
                .name("my-saved-query-private")
                .displayName("My Saved Query")
                .parent("projects/my-project-name")
                .location("global")
                .description("A saved query")
                .loggingQuery(SavedQueryLoggingQueryArgs.builder()
                    .filter("resource.type=gce_instance")
                    .build())
                .visibility("PRIVATE")
                .build());
    
        }
    }
    
    resources:
      savedQuery:
        type: gcp:logging:SavedQuery
        name: saved_query
        properties:
          name: my-saved-query-private
          displayName: My Saved Query
          parent: projects/my-project-name
          location: global
          description: A saved query
          loggingQuery:
            filter: resource.type=gce_instance
          visibility: PRIVATE
    

    Logging Saved Query Summary Fields

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const savedQuery = new gcp.logging.SavedQuery("saved_query", {
        name: "my-saved-query-summary-fields",
        displayName: "My Saved Query",
        parent: "projects/my-project-name",
        location: "global",
        description: "A saved query",
        loggingQuery: {
            filter: "resource.type=gce_instance",
            summaryFields: [
                {
                    field: "jsonPayload.paymentId",
                },
                {
                    field: "jsonPayload.errorMessage",
                },
            ],
            summaryFieldStart: 100,
        },
        visibility: "SHARED",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    saved_query = gcp.logging.SavedQuery("saved_query",
        name="my-saved-query-summary-fields",
        display_name="My Saved Query",
        parent="projects/my-project-name",
        location="global",
        description="A saved query",
        logging_query={
            "filter": "resource.type=gce_instance",
            "summary_fields": [
                {
                    "field": "jsonPayload.paymentId",
                },
                {
                    "field": "jsonPayload.errorMessage",
                },
            ],
            "summary_field_start": 100,
        },
        visibility="SHARED")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/logging"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := logging.NewSavedQuery(ctx, "saved_query", &logging.SavedQueryArgs{
    			Name:        pulumi.String("my-saved-query-summary-fields"),
    			DisplayName: pulumi.String("My Saved Query"),
    			Parent:      pulumi.String("projects/my-project-name"),
    			Location:    pulumi.String("global"),
    			Description: pulumi.String("A saved query"),
    			LoggingQuery: &logging.SavedQueryLoggingQueryArgs{
    				Filter: pulumi.String("resource.type=gce_instance"),
    				SummaryFields: logging.SavedQueryLoggingQuerySummaryFieldArray{
    					&logging.SavedQueryLoggingQuerySummaryFieldArgs{
    						Field: pulumi.String("jsonPayload.paymentId"),
    					},
    					&logging.SavedQueryLoggingQuerySummaryFieldArgs{
    						Field: pulumi.String("jsonPayload.errorMessage"),
    					},
    				},
    				SummaryFieldStart: pulumi.Int(100),
    			},
    			Visibility: pulumi.String("SHARED"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var savedQuery = new Gcp.Logging.SavedQuery("saved_query", new()
        {
            Name = "my-saved-query-summary-fields",
            DisplayName = "My Saved Query",
            Parent = "projects/my-project-name",
            Location = "global",
            Description = "A saved query",
            LoggingQuery = new Gcp.Logging.Inputs.SavedQueryLoggingQueryArgs
            {
                Filter = "resource.type=gce_instance",
                SummaryFields = new[]
                {
                    new Gcp.Logging.Inputs.SavedQueryLoggingQuerySummaryFieldArgs
                    {
                        Field = "jsonPayload.paymentId",
                    },
                    new Gcp.Logging.Inputs.SavedQueryLoggingQuerySummaryFieldArgs
                    {
                        Field = "jsonPayload.errorMessage",
                    },
                },
                SummaryFieldStart = 100,
            },
            Visibility = "SHARED",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.logging.SavedQuery;
    import com.pulumi.gcp.logging.SavedQueryArgs;
    import com.pulumi.gcp.logging.inputs.SavedQueryLoggingQueryArgs;
    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 savedQuery = new SavedQuery("savedQuery", SavedQueryArgs.builder()
                .name("my-saved-query-summary-fields")
                .displayName("My Saved Query")
                .parent("projects/my-project-name")
                .location("global")
                .description("A saved query")
                .loggingQuery(SavedQueryLoggingQueryArgs.builder()
                    .filter("resource.type=gce_instance")
                    .summaryFields(                
                        SavedQueryLoggingQuerySummaryFieldArgs.builder()
                            .field("jsonPayload.paymentId")
                            .build(),
                        SavedQueryLoggingQuerySummaryFieldArgs.builder()
                            .field("jsonPayload.errorMessage")
                            .build())
                    .summaryFieldStart(100)
                    .build())
                .visibility("SHARED")
                .build());
    
        }
    }
    
    resources:
      savedQuery:
        type: gcp:logging:SavedQuery
        name: saved_query
        properties:
          name: my-saved-query-summary-fields
          displayName: My Saved Query
          parent: projects/my-project-name
          location: global
          description: A saved query
          loggingQuery:
            filter: resource.type=gce_instance
            summaryFields:
              - field: jsonPayload.paymentId
              - field: jsonPayload.errorMessage
            summaryFieldStart: 100
          visibility: SHARED
    

    Logging Saved Query Sql Basic

    import * as pulumi from "@pulumi/pulumi";
    import * as gcp from "@pulumi/gcp";
    
    const savedQuery = new gcp.logging.SavedQuery("saved_query", {
        name: "my-saved-query-sql",
        displayName: "My Saved Query",
        parent: "projects/my-project-name",
        location: "global",
        description: "A saved query",
        opsAnalyticsQuery: {
            sqlQueryText: `SELECT
      timestamp, log_name, severity, json_payload, resource, labels
    FROM
      VIEW
    WHERE
      timestamp > TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 HOUR)
    ORDER BY timestamp ASC
    LIMIT 100
    `,
        },
        visibility: "SHARED",
    });
    
    import pulumi
    import pulumi_gcp as gcp
    
    saved_query = gcp.logging.SavedQuery("saved_query",
        name="my-saved-query-sql",
        display_name="My Saved Query",
        parent="projects/my-project-name",
        location="global",
        description="A saved query",
        ops_analytics_query={
            "sql_query_text": """SELECT
      timestamp, log_name, severity, json_payload, resource, labels
    FROM
      VIEW
    WHERE
      timestamp > TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 HOUR)
    ORDER BY timestamp ASC
    LIMIT 100
    """,
        },
        visibility="SHARED")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gcp/sdk/v9/go/gcp/logging"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := logging.NewSavedQuery(ctx, "saved_query", &logging.SavedQueryArgs{
    			Name:        pulumi.String("my-saved-query-sql"),
    			DisplayName: pulumi.String("My Saved Query"),
    			Parent:      pulumi.String("projects/my-project-name"),
    			Location:    pulumi.String("global"),
    			Description: pulumi.String("A saved query"),
    			OpsAnalyticsQuery: &logging.SavedQueryOpsAnalyticsQueryArgs{
    				SqlQueryText: pulumi.String(`SELECT
      timestamp, log_name, severity, json_payload, resource, labels
    FROM
      VIEW
    WHERE
      timestamp > TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 HOUR)
    ORDER BY timestamp ASC
    LIMIT 100
    `),
    			},
    			Visibility: pulumi.String("SHARED"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Gcp = Pulumi.Gcp;
    
    return await Deployment.RunAsync(() => 
    {
        var savedQuery = new Gcp.Logging.SavedQuery("saved_query", new()
        {
            Name = "my-saved-query-sql",
            DisplayName = "My Saved Query",
            Parent = "projects/my-project-name",
            Location = "global",
            Description = "A saved query",
            OpsAnalyticsQuery = new Gcp.Logging.Inputs.SavedQueryOpsAnalyticsQueryArgs
            {
                SqlQueryText = @"SELECT
      timestamp, log_name, severity, json_payload, resource, labels
    FROM
      VIEW
    WHERE
      timestamp > TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 HOUR)
    ORDER BY timestamp ASC
    LIMIT 100
    ",
            },
            Visibility = "SHARED",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gcp.logging.SavedQuery;
    import com.pulumi.gcp.logging.SavedQueryArgs;
    import com.pulumi.gcp.logging.inputs.SavedQueryOpsAnalyticsQueryArgs;
    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 savedQuery = new SavedQuery("savedQuery", SavedQueryArgs.builder()
                .name("my-saved-query-sql")
                .displayName("My Saved Query")
                .parent("projects/my-project-name")
                .location("global")
                .description("A saved query")
                .opsAnalyticsQuery(SavedQueryOpsAnalyticsQueryArgs.builder()
                    .sqlQueryText("""
    SELECT
      timestamp, log_name, severity, json_payload, resource, labels
    FROM
      VIEW
    WHERE
      timestamp > TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 HOUR)
    ORDER BY timestamp ASC
    LIMIT 100
                    """)
                    .build())
                .visibility("SHARED")
                .build());
    
        }
    }
    
    resources:
      savedQuery:
        type: gcp:logging:SavedQuery
        name: saved_query
        properties:
          name: my-saved-query-sql
          displayName: My Saved Query
          parent: projects/my-project-name
          location: global
          description: A saved query
          opsAnalyticsQuery:
            sqlQueryText: |
              SELECT
                timestamp, log_name, severity, json_payload, resource, labels
              FROM
                VIEW
              WHERE
                timestamp > TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 1 HOUR)
              ORDER BY timestamp ASC
              LIMIT 100
          visibility: SHARED
    

    Create SavedQuery Resource

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

    Constructor syntax

    new SavedQuery(name: string, args: SavedQueryArgs, opts?: CustomResourceOptions);
    @overload
    def SavedQuery(resource_name: str,
                   args: SavedQueryArgs,
                   opts: Optional[ResourceOptions] = None)
    
    @overload
    def SavedQuery(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   display_name: Optional[str] = None,
                   location: Optional[str] = None,
                   parent: Optional[str] = None,
                   visibility: Optional[str] = None,
                   description: Optional[str] = None,
                   logging_query: Optional[SavedQueryLoggingQueryArgs] = None,
                   name: Optional[str] = None,
                   ops_analytics_query: Optional[SavedQueryOpsAnalyticsQueryArgs] = None)
    func NewSavedQuery(ctx *Context, name string, args SavedQueryArgs, opts ...ResourceOption) (*SavedQuery, error)
    public SavedQuery(string name, SavedQueryArgs args, CustomResourceOptions? opts = null)
    public SavedQuery(String name, SavedQueryArgs args)
    public SavedQuery(String name, SavedQueryArgs args, CustomResourceOptions options)
    
    type: gcp:logging:SavedQuery
    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 SavedQueryArgs
    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 SavedQueryArgs
    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 SavedQueryArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SavedQueryArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SavedQueryArgs
    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 savedQueryResource = new Gcp.Logging.SavedQuery("savedQueryResource", new()
    {
        DisplayName = "string",
        Location = "string",
        Parent = "string",
        Visibility = "string",
        Description = "string",
        LoggingQuery = new Gcp.Logging.Inputs.SavedQueryLoggingQueryArgs
        {
            Filter = "string",
            SummaryFieldEnd = 0,
            SummaryFieldStart = 0,
            SummaryFields = new[]
            {
                new Gcp.Logging.Inputs.SavedQueryLoggingQuerySummaryFieldArgs
                {
                    Field = "string",
                },
            },
        },
        Name = "string",
        OpsAnalyticsQuery = new Gcp.Logging.Inputs.SavedQueryOpsAnalyticsQueryArgs
        {
            SqlQueryText = "string",
        },
    });
    
    example, err := logging.NewSavedQuery(ctx, "savedQueryResource", &logging.SavedQueryArgs{
    	DisplayName: pulumi.String("string"),
    	Location:    pulumi.String("string"),
    	Parent:      pulumi.String("string"),
    	Visibility:  pulumi.String("string"),
    	Description: pulumi.String("string"),
    	LoggingQuery: &logging.SavedQueryLoggingQueryArgs{
    		Filter:            pulumi.String("string"),
    		SummaryFieldEnd:   pulumi.Int(0),
    		SummaryFieldStart: pulumi.Int(0),
    		SummaryFields: logging.SavedQueryLoggingQuerySummaryFieldArray{
    			&logging.SavedQueryLoggingQuerySummaryFieldArgs{
    				Field: pulumi.String("string"),
    			},
    		},
    	},
    	Name: pulumi.String("string"),
    	OpsAnalyticsQuery: &logging.SavedQueryOpsAnalyticsQueryArgs{
    		SqlQueryText: pulumi.String("string"),
    	},
    })
    
    var savedQueryResource = new SavedQuery("savedQueryResource", SavedQueryArgs.builder()
        .displayName("string")
        .location("string")
        .parent("string")
        .visibility("string")
        .description("string")
        .loggingQuery(SavedQueryLoggingQueryArgs.builder()
            .filter("string")
            .summaryFieldEnd(0)
            .summaryFieldStart(0)
            .summaryFields(SavedQueryLoggingQuerySummaryFieldArgs.builder()
                .field("string")
                .build())
            .build())
        .name("string")
        .opsAnalyticsQuery(SavedQueryOpsAnalyticsQueryArgs.builder()
            .sqlQueryText("string")
            .build())
        .build());
    
    saved_query_resource = gcp.logging.SavedQuery("savedQueryResource",
        display_name="string",
        location="string",
        parent="string",
        visibility="string",
        description="string",
        logging_query={
            "filter": "string",
            "summary_field_end": 0,
            "summary_field_start": 0,
            "summary_fields": [{
                "field": "string",
            }],
        },
        name="string",
        ops_analytics_query={
            "sql_query_text": "string",
        })
    
    const savedQueryResource = new gcp.logging.SavedQuery("savedQueryResource", {
        displayName: "string",
        location: "string",
        parent: "string",
        visibility: "string",
        description: "string",
        loggingQuery: {
            filter: "string",
            summaryFieldEnd: 0,
            summaryFieldStart: 0,
            summaryFields: [{
                field: "string",
            }],
        },
        name: "string",
        opsAnalyticsQuery: {
            sqlQueryText: "string",
        },
    });
    
    type: gcp:logging:SavedQuery
    properties:
        description: string
        displayName: string
        location: string
        loggingQuery:
            filter: string
            summaryFieldEnd: 0
            summaryFieldStart: 0
            summaryFields:
                - field: string
        name: string
        opsAnalyticsQuery:
            sqlQueryText: string
        parent: string
        visibility: string
    

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

    DisplayName string
    The user-visible display name of the saved query.
    Location string
    The location of the resource see supported regions.
    Parent string
    The parent of the resource.
    Visibility string
    The visibility of the saved query. Possible values are: SHARED, PRIVATE.
    Description string
    A description of the saved query.
    LoggingQuery SavedQueryLoggingQuery
    The contents of the saved query. Structure is documented below.
    Name string
    The name of the saved query. For example: my-saved-query
    OpsAnalyticsQuery SavedQueryOpsAnalyticsQuery
    The contents of the saved query. Structure is documented below.
    DisplayName string
    The user-visible display name of the saved query.
    Location string
    The location of the resource see supported regions.
    Parent string
    The parent of the resource.
    Visibility string
    The visibility of the saved query. Possible values are: SHARED, PRIVATE.
    Description string
    A description of the saved query.
    LoggingQuery SavedQueryLoggingQueryArgs
    The contents of the saved query. Structure is documented below.
    Name string
    The name of the saved query. For example: my-saved-query
    OpsAnalyticsQuery SavedQueryOpsAnalyticsQueryArgs
    The contents of the saved query. Structure is documented below.
    displayName String
    The user-visible display name of the saved query.
    location String
    The location of the resource see supported regions.
    parent String
    The parent of the resource.
    visibility String
    The visibility of the saved query. Possible values are: SHARED, PRIVATE.
    description String
    A description of the saved query.
    loggingQuery SavedQueryLoggingQuery
    The contents of the saved query. Structure is documented below.
    name String
    The name of the saved query. For example: my-saved-query
    opsAnalyticsQuery SavedQueryOpsAnalyticsQuery
    The contents of the saved query. Structure is documented below.
    displayName string
    The user-visible display name of the saved query.
    location string
    The location of the resource see supported regions.
    parent string
    The parent of the resource.
    visibility string
    The visibility of the saved query. Possible values are: SHARED, PRIVATE.
    description string
    A description of the saved query.
    loggingQuery SavedQueryLoggingQuery
    The contents of the saved query. Structure is documented below.
    name string
    The name of the saved query. For example: my-saved-query
    opsAnalyticsQuery SavedQueryOpsAnalyticsQuery
    The contents of the saved query. Structure is documented below.
    display_name str
    The user-visible display name of the saved query.
    location str
    The location of the resource see supported regions.
    parent str
    The parent of the resource.
    visibility str
    The visibility of the saved query. Possible values are: SHARED, PRIVATE.
    description str
    A description of the saved query.
    logging_query SavedQueryLoggingQueryArgs
    The contents of the saved query. Structure is documented below.
    name str
    The name of the saved query. For example: my-saved-query
    ops_analytics_query SavedQueryOpsAnalyticsQueryArgs
    The contents of the saved query. Structure is documented below.
    displayName String
    The user-visible display name of the saved query.
    location String
    The location of the resource see supported regions.
    parent String
    The parent of the resource.
    visibility String
    The visibility of the saved query. Possible values are: SHARED, PRIVATE.
    description String
    A description of the saved query.
    loggingQuery Property Map
    The contents of the saved query. Structure is documented below.
    name String
    The name of the saved query. For example: my-saved-query
    opsAnalyticsQuery Property Map
    The contents of the saved query. Structure is documented below.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the SavedQuery resource produces the following output properties:

    CreateTime string
    Output only. The creation timestamp of the saved query.
    Id string
    The provider-assigned unique ID for this managed resource.
    UpdateTime string
    Output only. The last update timestamp of the saved query.
    CreateTime string
    Output only. The creation timestamp of the saved query.
    Id string
    The provider-assigned unique ID for this managed resource.
    UpdateTime string
    Output only. The last update timestamp of the saved query.
    createTime String
    Output only. The creation timestamp of the saved query.
    id String
    The provider-assigned unique ID for this managed resource.
    updateTime String
    Output only. The last update timestamp of the saved query.
    createTime string
    Output only. The creation timestamp of the saved query.
    id string
    The provider-assigned unique ID for this managed resource.
    updateTime string
    Output only. The last update timestamp of the saved query.
    create_time str
    Output only. The creation timestamp of the saved query.
    id str
    The provider-assigned unique ID for this managed resource.
    update_time str
    Output only. The last update timestamp of the saved query.
    createTime String
    Output only. The creation timestamp of the saved query.
    id String
    The provider-assigned unique ID for this managed resource.
    updateTime String
    Output only. The last update timestamp of the saved query.

    Look up Existing SavedQuery Resource

    Get an existing SavedQuery 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?: SavedQueryState, opts?: CustomResourceOptions): SavedQuery
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            create_time: Optional[str] = None,
            description: Optional[str] = None,
            display_name: Optional[str] = None,
            location: Optional[str] = None,
            logging_query: Optional[SavedQueryLoggingQueryArgs] = None,
            name: Optional[str] = None,
            ops_analytics_query: Optional[SavedQueryOpsAnalyticsQueryArgs] = None,
            parent: Optional[str] = None,
            update_time: Optional[str] = None,
            visibility: Optional[str] = None) -> SavedQuery
    func GetSavedQuery(ctx *Context, name string, id IDInput, state *SavedQueryState, opts ...ResourceOption) (*SavedQuery, error)
    public static SavedQuery Get(string name, Input<string> id, SavedQueryState? state, CustomResourceOptions? opts = null)
    public static SavedQuery get(String name, Output<String> id, SavedQueryState state, CustomResourceOptions options)
    resources:  _:    type: gcp:logging:SavedQuery    get:      id: ${id}
    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:
    CreateTime string
    Output only. The creation timestamp of the saved query.
    Description string
    A description of the saved query.
    DisplayName string
    The user-visible display name of the saved query.
    Location string
    The location of the resource see supported regions.
    LoggingQuery SavedQueryLoggingQuery
    The contents of the saved query. Structure is documented below.
    Name string
    The name of the saved query. For example: my-saved-query
    OpsAnalyticsQuery SavedQueryOpsAnalyticsQuery
    The contents of the saved query. Structure is documented below.
    Parent string
    The parent of the resource.
    UpdateTime string
    Output only. The last update timestamp of the saved query.
    Visibility string
    The visibility of the saved query. Possible values are: SHARED, PRIVATE.
    CreateTime string
    Output only. The creation timestamp of the saved query.
    Description string
    A description of the saved query.
    DisplayName string
    The user-visible display name of the saved query.
    Location string
    The location of the resource see supported regions.
    LoggingQuery SavedQueryLoggingQueryArgs
    The contents of the saved query. Structure is documented below.
    Name string
    The name of the saved query. For example: my-saved-query
    OpsAnalyticsQuery SavedQueryOpsAnalyticsQueryArgs
    The contents of the saved query. Structure is documented below.
    Parent string
    The parent of the resource.
    UpdateTime string
    Output only. The last update timestamp of the saved query.
    Visibility string
    The visibility of the saved query. Possible values are: SHARED, PRIVATE.
    createTime String
    Output only. The creation timestamp of the saved query.
    description String
    A description of the saved query.
    displayName String
    The user-visible display name of the saved query.
    location String
    The location of the resource see supported regions.
    loggingQuery SavedQueryLoggingQuery
    The contents of the saved query. Structure is documented below.
    name String
    The name of the saved query. For example: my-saved-query
    opsAnalyticsQuery SavedQueryOpsAnalyticsQuery
    The contents of the saved query. Structure is documented below.
    parent String
    The parent of the resource.
    updateTime String
    Output only. The last update timestamp of the saved query.
    visibility String
    The visibility of the saved query. Possible values are: SHARED, PRIVATE.
    createTime string
    Output only. The creation timestamp of the saved query.
    description string
    A description of the saved query.
    displayName string
    The user-visible display name of the saved query.
    location string
    The location of the resource see supported regions.
    loggingQuery SavedQueryLoggingQuery
    The contents of the saved query. Structure is documented below.
    name string
    The name of the saved query. For example: my-saved-query
    opsAnalyticsQuery SavedQueryOpsAnalyticsQuery
    The contents of the saved query. Structure is documented below.
    parent string
    The parent of the resource.
    updateTime string
    Output only. The last update timestamp of the saved query.
    visibility string
    The visibility of the saved query. Possible values are: SHARED, PRIVATE.
    create_time str
    Output only. The creation timestamp of the saved query.
    description str
    A description of the saved query.
    display_name str
    The user-visible display name of the saved query.
    location str
    The location of the resource see supported regions.
    logging_query SavedQueryLoggingQueryArgs
    The contents of the saved query. Structure is documented below.
    name str
    The name of the saved query. For example: my-saved-query
    ops_analytics_query SavedQueryOpsAnalyticsQueryArgs
    The contents of the saved query. Structure is documented below.
    parent str
    The parent of the resource.
    update_time str
    Output only. The last update timestamp of the saved query.
    visibility str
    The visibility of the saved query. Possible values are: SHARED, PRIVATE.
    createTime String
    Output only. The creation timestamp of the saved query.
    description String
    A description of the saved query.
    displayName String
    The user-visible display name of the saved query.
    location String
    The location of the resource see supported regions.
    loggingQuery Property Map
    The contents of the saved query. Structure is documented below.
    name String
    The name of the saved query. For example: my-saved-query
    opsAnalyticsQuery Property Map
    The contents of the saved query. Structure is documented below.
    parent String
    The parent of the resource.
    updateTime String
    Output only. The last update timestamp of the saved query.
    visibility String
    The visibility of the saved query. Possible values are: SHARED, PRIVATE.

    Supporting Types

    SavedQueryLoggingQuery, SavedQueryLoggingQueryArgs

    Filter string
    An advanced logs filter which is used to match log entries.
    SummaryFieldEnd int
    Characters will be counted from the end of the string.
    SummaryFieldStart int
    Characters will be counted from the start of the string.
    SummaryFields List<SavedQueryLoggingQuerySummaryField>
    The names of the fields to display in the summary. Structure is documented below.
    Filter string
    An advanced logs filter which is used to match log entries.
    SummaryFieldEnd int
    Characters will be counted from the end of the string.
    SummaryFieldStart int
    Characters will be counted from the start of the string.
    SummaryFields []SavedQueryLoggingQuerySummaryField
    The names of the fields to display in the summary. Structure is documented below.
    filter String
    An advanced logs filter which is used to match log entries.
    summaryFieldEnd Integer
    Characters will be counted from the end of the string.
    summaryFieldStart Integer
    Characters will be counted from the start of the string.
    summaryFields List<SavedQueryLoggingQuerySummaryField>
    The names of the fields to display in the summary. Structure is documented below.
    filter string
    An advanced logs filter which is used to match log entries.
    summaryFieldEnd number
    Characters will be counted from the end of the string.
    summaryFieldStart number
    Characters will be counted from the start of the string.
    summaryFields SavedQueryLoggingQuerySummaryField[]
    The names of the fields to display in the summary. Structure is documented below.
    filter str
    An advanced logs filter which is used to match log entries.
    summary_field_end int
    Characters will be counted from the end of the string.
    summary_field_start int
    Characters will be counted from the start of the string.
    summary_fields Sequence[SavedQueryLoggingQuerySummaryField]
    The names of the fields to display in the summary. Structure is documented below.
    filter String
    An advanced logs filter which is used to match log entries.
    summaryFieldEnd Number
    Characters will be counted from the end of the string.
    summaryFieldStart Number
    Characters will be counted from the start of the string.
    summaryFields List<Property Map>
    The names of the fields to display in the summary. Structure is documented below.

    SavedQueryLoggingQuerySummaryField, SavedQueryLoggingQuerySummaryFieldArgs

    Field string
    The field from the LogEntry to include in the summary line.
    Field string
    The field from the LogEntry to include in the summary line.
    field String
    The field from the LogEntry to include in the summary line.
    field string
    The field from the LogEntry to include in the summary line.
    field str
    The field from the LogEntry to include in the summary line.
    field String
    The field from the LogEntry to include in the summary line.

    SavedQueryOpsAnalyticsQuery, SavedQueryOpsAnalyticsQueryArgs

    SqlQueryText string
    A logs analytics SQL query, which generally follows BigQuery format.
    SqlQueryText string
    A logs analytics SQL query, which generally follows BigQuery format.
    sqlQueryText String
    A logs analytics SQL query, which generally follows BigQuery format.
    sqlQueryText string
    A logs analytics SQL query, which generally follows BigQuery format.
    sql_query_text str
    A logs analytics SQL query, which generally follows BigQuery format.
    sqlQueryText String
    A logs analytics SQL query, which generally follows BigQuery format.

    Import

    SavedQuery can be imported using any of these accepted formats:

    • {{parent}}/locations/{{location}}/savedQueries/{{name}}

    When using the pulumi import command, SavedQuery can be imported using one of the formats above. For example:

    $ pulumi import gcp:logging/savedQuery:SavedQuery default {{parent}}/locations/{{location}}/savedQueries/{{name}}
    

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

    Package Details

    Repository
    Google Cloud (GCP) Classic pulumi/pulumi-gcp
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the google-beta Terraform Provider.
    gcp logo
    Viewing docs for Google Cloud v9.15.0
    published on Thursday, Mar 12, 2026 by Pulumi
      Try Pulumi Cloud free. Your team will thank you.