1. Packages
  2. Packages
  3. Alibaba Cloud Provider
  4. API Docs
  5. das
  6. SqlLogConfig
Viewing docs for Alibaba Cloud v3.105.0
published on Thursday, Jul 16, 2026 by Pulumi
alicloud logo alicloud logo
Viewing docs for Alibaba Cloud v3.105.0
published on Thursday, Jul 16, 2026 by Pulumi

    Provides a DAS Sql Log Config resource.

    SQL audit log configuration for database instances.

    For information about DAS Sql Log Config and how to use it, see What is Sql Log Config.

    NOTE: Available since v1.285.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    
    const config = new pulumi.Config();
    const name = config.get("name") || "tf-example";
    const _default = alicloud.rds.getInstances({
        status: "Running",
    });
    const defaultSqlLogConfig = new alicloud.das.SqlLogConfig("default", {
        instanceId: _default.then(_default => _default.instances?.[0]?.id),
        enable: true,
        requestEnable: true,
        retention: 30,
        hotRetention: 7,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "tf-example"
    default = alicloud.rds.get_instances(status="Running")
    default_sql_log_config = alicloud.das.SqlLogConfig("default",
        instance_id=default.instances[0].id,
        enable=True,
        request_enable=True,
        retention=30,
        hot_retention=7)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/das"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/rds"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		cfg := config.New(ctx, "")
    		name := "tf-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_default, err := rds.GetInstances(ctx, &rds.GetInstancesArgs{
    			Status: pulumi.StringRef("Running"),
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = das.NewSqlLogConfig(ctx, "default", &das.SqlLogConfigArgs{
    			InstanceId:    pulumi.String(_default.Instances[0].Id),
    			Enable:        pulumi.Bool(true),
    			RequestEnable: pulumi.Bool(true),
    			Retention:     pulumi.Int(30),
    			HotRetention:  pulumi.Int(7),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    
    return await Deployment.RunAsync(() => 
    {
        var config = new Config();
        var name = config.Get("name") ?? "tf-example";
        var @default = AliCloud.Rds.GetInstances.Invoke(new()
        {
            Status = "Running",
        });
    
        var defaultSqlLogConfig = new AliCloud.Das.SqlLogConfig("default", new()
        {
            InstanceId = @default.Apply(@default => @default.Apply(getInstancesResult => getInstancesResult.Instances[0]?.Id)),
            Enable = true,
            RequestEnable = true,
            Retention = 30,
            HotRetention = 7,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.rds.RdsFunctions;
    import com.pulumi.alicloud.rds.inputs.GetInstancesArgs;
    import com.pulumi.alicloud.das.SqlLogConfig;
    import com.pulumi.alicloud.das.SqlLogConfigArgs;
    import java.util.ArrayList;
    import java.util.Arrays;
    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) {
            final var config = ctx.config();
            final var name = config.get("name").orElse("tf-example");
            final var default = RdsFunctions.getInstances(GetInstancesArgs.builder()
                .status("Running")
                .build());
    
            var defaultSqlLogConfig = new SqlLogConfig("defaultSqlLogConfig", SqlLogConfigArgs.builder()
                .instanceId(default_.instances()[0].id())
                .enable(true)
                .requestEnable(true)
                .retention(30)
                .hotRetention(7)
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: tf-example
    resources:
      defaultSqlLogConfig:
        type: alicloud:das:SqlLogConfig
        name: default
        properties:
          instanceId: ${default.instances[0].id}
          enable: true
          requestEnable: true
          retention: 30
          hotRetention: 7
    variables:
      default:
        fn::invoke:
          function: alicloud:rds:getInstances
          arguments:
            status: Running
    
    pulumi {
      required_providers {
        alicloud = {
          source = "pulumi/alicloud"
        }
      }
    }
    
    data "alicloud_rds_getinstances" "default" {
      status = "Running"
    }
    
    resource "alicloud_das_sqllogconfig" "default" {
      instance_id    = data.alicloud_rds_getinstances.default.instances[0].id
      enable         = true
      request_enable = true
      retention      = 30
      hot_retention  = 7
    }
    variable "name" {
      type    = string
      default = "tf-example"
    }
    

    Deleting alicloud.das.SqlLogConfig or removing it from your configuration

    Terraform cannot destroy resource alicloud.das.SqlLogConfig. Terraform will remove this resource from the state file, however resources may remain.

    📚 Need more examples? VIEW MORE EXAMPLES

    Create SqlLogConfig Resource

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

    Constructor syntax

    new SqlLogConfig(name: string, args: SqlLogConfigArgs, opts?: CustomResourceOptions);
    @overload
    def SqlLogConfig(resource_name: str,
                     args: SqlLogConfigArgs,
                     opts: Optional[ResourceOptions] = None)
    
    @overload
    def SqlLogConfig(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     instance_id: Optional[str] = None,
                     enable: Optional[bool] = None,
                     hot_retention: Optional[int] = None,
                     request_enable: Optional[bool] = None,
                     retention: Optional[int] = None)
    func NewSqlLogConfig(ctx *Context, name string, args SqlLogConfigArgs, opts ...ResourceOption) (*SqlLogConfig, error)
    public SqlLogConfig(string name, SqlLogConfigArgs args, CustomResourceOptions? opts = null)
    public SqlLogConfig(String name, SqlLogConfigArgs args)
    public SqlLogConfig(String name, SqlLogConfigArgs args, CustomResourceOptions options)
    
    type: alicloud:das:SqlLogConfig
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "alicloud_das_sql_log_config" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args SqlLogConfigArgs
    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 SqlLogConfigArgs
    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 SqlLogConfigArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args SqlLogConfigArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args SqlLogConfigArgs
    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 sqlLogConfigResource = new AliCloud.Das.SqlLogConfig("sqlLogConfigResource", new()
    {
        InstanceId = "string",
        Enable = false,
        HotRetention = 0,
        RequestEnable = false,
        Retention = 0,
    });
    
    example, err := das.NewSqlLogConfig(ctx, "sqlLogConfigResource", &das.SqlLogConfigArgs{
    	InstanceId:    pulumi.String("string"),
    	Enable:        pulumi.Bool(false),
    	HotRetention:  pulumi.Int(0),
    	RequestEnable: pulumi.Bool(false),
    	Retention:     pulumi.Int(0),
    })
    
    resource "alicloud_das_sql_log_config" "sqlLogConfigResource" {
      lifecycle {
        create_before_destroy = true
      }
      instance_id    = "string"
      enable         = false
      hot_retention  = 0
      request_enable = false
      retention      = 0
    }
    
    var sqlLogConfigResource = new SqlLogConfig("sqlLogConfigResource", SqlLogConfigArgs.builder()
        .instanceId("string")
        .enable(false)
        .hotRetention(0)
        .requestEnable(false)
        .retention(0)
        .build());
    
    sql_log_config_resource = alicloud.das.SqlLogConfig("sqlLogConfigResource",
        instance_id="string",
        enable=False,
        hot_retention=0,
        request_enable=False,
        retention=0)
    
    const sqlLogConfigResource = new alicloud.das.SqlLogConfig("sqlLogConfigResource", {
        instanceId: "string",
        enable: false,
        hotRetention: 0,
        requestEnable: false,
        retention: 0,
    });
    
    type: alicloud:das:SqlLogConfig
    properties:
        enable: false
        hotRetention: 0
        instanceId: string
        requestEnable: false
        retention: 0
    

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

    InstanceId string
    The ID of the database instance.
    Enable bool
    Specifies whether SQL Explorer is enabled.
    HotRetention int
    The retention period of hot SQL audit logs. Unit: days.
    RequestEnable bool
    The requested state of SQL Explorer.
    Retention int
    The retention period of SQL audit logs. Unit: days.
    InstanceId string
    The ID of the database instance.
    Enable bool
    Specifies whether SQL Explorer is enabled.
    HotRetention int
    The retention period of hot SQL audit logs. Unit: days.
    RequestEnable bool
    The requested state of SQL Explorer.
    Retention int
    The retention period of SQL audit logs. Unit: days.
    instance_id string
    The ID of the database instance.
    enable bool
    Specifies whether SQL Explorer is enabled.
    hot_retention number
    The retention period of hot SQL audit logs. Unit: days.
    request_enable bool
    The requested state of SQL Explorer.
    retention number
    The retention period of SQL audit logs. Unit: days.
    instanceId String
    The ID of the database instance.
    enable Boolean
    Specifies whether SQL Explorer is enabled.
    hotRetention Integer
    The retention period of hot SQL audit logs. Unit: days.
    requestEnable Boolean
    The requested state of SQL Explorer.
    retention Integer
    The retention period of SQL audit logs. Unit: days.
    instanceId string
    The ID of the database instance.
    enable boolean
    Specifies whether SQL Explorer is enabled.
    hotRetention number
    The retention period of hot SQL audit logs. Unit: days.
    requestEnable boolean
    The requested state of SQL Explorer.
    retention number
    The retention period of SQL audit logs. Unit: days.
    instance_id str
    The ID of the database instance.
    enable bool
    Specifies whether SQL Explorer is enabled.
    hot_retention int
    The retention period of hot SQL audit logs. Unit: days.
    request_enable bool
    The requested state of SQL Explorer.
    retention int
    The retention period of SQL audit logs. Unit: days.
    instanceId String
    The ID of the database instance.
    enable Boolean
    Specifies whether SQL Explorer is enabled.
    hotRetention Number
    The retention period of hot SQL audit logs. Unit: days.
    requestEnable Boolean
    The requested state of SQL Explorer.
    retention Number
    The retention period of SQL audit logs. Unit: days.

    Outputs

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

    ColdRetention int
    The retention period of cold SQL audit logs. Calculated as retention - hotRetention.
    Id string
    The provider-assigned unique ID for this managed resource.
    LogFilter string
    The configuration of log filters.
    SqlLogVisibleTime int
    The visible start time of SQL audit logs.
    Version string
    The current version of SQL audit logs.
    ColdRetention int
    The retention period of cold SQL audit logs. Calculated as retention - hotRetention.
    Id string
    The provider-assigned unique ID for this managed resource.
    LogFilter string
    The configuration of log filters.
    SqlLogVisibleTime int
    The visible start time of SQL audit logs.
    Version string
    The current version of SQL audit logs.
    cold_retention number
    The retention period of cold SQL audit logs. Calculated as retention - hotRetention.
    id string
    The provider-assigned unique ID for this managed resource.
    log_filter string
    The configuration of log filters.
    sql_log_visible_time number
    The visible start time of SQL audit logs.
    version string
    The current version of SQL audit logs.
    coldRetention Integer
    The retention period of cold SQL audit logs. Calculated as retention - hotRetention.
    id String
    The provider-assigned unique ID for this managed resource.
    logFilter String
    The configuration of log filters.
    sqlLogVisibleTime Integer
    The visible start time of SQL audit logs.
    version String
    The current version of SQL audit logs.
    coldRetention number
    The retention period of cold SQL audit logs. Calculated as retention - hotRetention.
    id string
    The provider-assigned unique ID for this managed resource.
    logFilter string
    The configuration of log filters.
    sqlLogVisibleTime number
    The visible start time of SQL audit logs.
    version string
    The current version of SQL audit logs.
    cold_retention int
    The retention period of cold SQL audit logs. Calculated as retention - hotRetention.
    id str
    The provider-assigned unique ID for this managed resource.
    log_filter str
    The configuration of log filters.
    sql_log_visible_time int
    The visible start time of SQL audit logs.
    version str
    The current version of SQL audit logs.
    coldRetention Number
    The retention period of cold SQL audit logs. Calculated as retention - hotRetention.
    id String
    The provider-assigned unique ID for this managed resource.
    logFilter String
    The configuration of log filters.
    sqlLogVisibleTime Number
    The visible start time of SQL audit logs.
    version String
    The current version of SQL audit logs.

    Look up Existing SqlLogConfig Resource

    Get an existing SqlLogConfig 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?: SqlLogConfigState, opts?: CustomResourceOptions): SqlLogConfig
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            cold_retention: Optional[int] = None,
            enable: Optional[bool] = None,
            hot_retention: Optional[int] = None,
            instance_id: Optional[str] = None,
            log_filter: Optional[str] = None,
            request_enable: Optional[bool] = None,
            retention: Optional[int] = None,
            sql_log_visible_time: Optional[int] = None,
            version: Optional[str] = None) -> SqlLogConfig
    func GetSqlLogConfig(ctx *Context, name string, id IDInput, state *SqlLogConfigState, opts ...ResourceOption) (*SqlLogConfig, error)
    public static SqlLogConfig Get(string name, Input<string> id, SqlLogConfigState? state, CustomResourceOptions? opts = null)
    public static SqlLogConfig get(String name, Output<String> id, SqlLogConfigState state, CustomResourceOptions options)
    resources:  _:    type: alicloud:das:SqlLogConfig    get:      id: ${id}
    import {
      to = alicloud_das_sql_log_config.example
      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:
    ColdRetention int
    The retention period of cold SQL audit logs. Calculated as retention - hotRetention.
    Enable bool
    Specifies whether SQL Explorer is enabled.
    HotRetention int
    The retention period of hot SQL audit logs. Unit: days.
    InstanceId string
    The ID of the database instance.
    LogFilter string
    The configuration of log filters.
    RequestEnable bool
    The requested state of SQL Explorer.
    Retention int
    The retention period of SQL audit logs. Unit: days.
    SqlLogVisibleTime int
    The visible start time of SQL audit logs.
    Version string
    The current version of SQL audit logs.
    ColdRetention int
    The retention period of cold SQL audit logs. Calculated as retention - hotRetention.
    Enable bool
    Specifies whether SQL Explorer is enabled.
    HotRetention int
    The retention period of hot SQL audit logs. Unit: days.
    InstanceId string
    The ID of the database instance.
    LogFilter string
    The configuration of log filters.
    RequestEnable bool
    The requested state of SQL Explorer.
    Retention int
    The retention period of SQL audit logs. Unit: days.
    SqlLogVisibleTime int
    The visible start time of SQL audit logs.
    Version string
    The current version of SQL audit logs.
    cold_retention number
    The retention period of cold SQL audit logs. Calculated as retention - hotRetention.
    enable bool
    Specifies whether SQL Explorer is enabled.
    hot_retention number
    The retention period of hot SQL audit logs. Unit: days.
    instance_id string
    The ID of the database instance.
    log_filter string
    The configuration of log filters.
    request_enable bool
    The requested state of SQL Explorer.
    retention number
    The retention period of SQL audit logs. Unit: days.
    sql_log_visible_time number
    The visible start time of SQL audit logs.
    version string
    The current version of SQL audit logs.
    coldRetention Integer
    The retention period of cold SQL audit logs. Calculated as retention - hotRetention.
    enable Boolean
    Specifies whether SQL Explorer is enabled.
    hotRetention Integer
    The retention period of hot SQL audit logs. Unit: days.
    instanceId String
    The ID of the database instance.
    logFilter String
    The configuration of log filters.
    requestEnable Boolean
    The requested state of SQL Explorer.
    retention Integer
    The retention period of SQL audit logs. Unit: days.
    sqlLogVisibleTime Integer
    The visible start time of SQL audit logs.
    version String
    The current version of SQL audit logs.
    coldRetention number
    The retention period of cold SQL audit logs. Calculated as retention - hotRetention.
    enable boolean
    Specifies whether SQL Explorer is enabled.
    hotRetention number
    The retention period of hot SQL audit logs. Unit: days.
    instanceId string
    The ID of the database instance.
    logFilter string
    The configuration of log filters.
    requestEnable boolean
    The requested state of SQL Explorer.
    retention number
    The retention period of SQL audit logs. Unit: days.
    sqlLogVisibleTime number
    The visible start time of SQL audit logs.
    version string
    The current version of SQL audit logs.
    cold_retention int
    The retention period of cold SQL audit logs. Calculated as retention - hotRetention.
    enable bool
    Specifies whether SQL Explorer is enabled.
    hot_retention int
    The retention period of hot SQL audit logs. Unit: days.
    instance_id str
    The ID of the database instance.
    log_filter str
    The configuration of log filters.
    request_enable bool
    The requested state of SQL Explorer.
    retention int
    The retention period of SQL audit logs. Unit: days.
    sql_log_visible_time int
    The visible start time of SQL audit logs.
    version str
    The current version of SQL audit logs.
    coldRetention Number
    The retention period of cold SQL audit logs. Calculated as retention - hotRetention.
    enable Boolean
    Specifies whether SQL Explorer is enabled.
    hotRetention Number
    The retention period of hot SQL audit logs. Unit: days.
    instanceId String
    The ID of the database instance.
    logFilter String
    The configuration of log filters.
    requestEnable Boolean
    The requested state of SQL Explorer.
    retention Number
    The retention period of SQL audit logs. Unit: days.
    sqlLogVisibleTime Number
    The visible start time of SQL audit logs.
    version String
    The current version of SQL audit logs.

    Import

    DAS Sql Log Config can be imported using the id, e.g.

    $ pulumi import alicloud:das/sqlLogConfig:SqlLogConfig example <instance_id>
    

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

    Package Details

    Repository
    Alibaba Cloud pulumi/pulumi-alicloud
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the alicloud Terraform Provider.
    alicloud logo alicloud logo
    Viewing docs for Alibaba Cloud v3.105.0
    published on Thursday, Jul 16, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial