1. Registry
  2. Packages
  3. Alibaba Cloud Provider
  4. API Docs
  5. message
  6. ServiceAccountLogging
Viewing docs for Alibaba Cloud v3.106.0
published on Monday, Aug 24, 2026 by Pulumi
alicloud logo alicloud logo
Viewing docs for Alibaba Cloud v3.106.0
published on Monday, Aug 24, 2026 by Pulumi

    Provides a Message Service Account Logging resource.

    Account Logging Configuration.

    For information about Message Service Account Logging and how to use it, see What is Account Logging.

    NOTE: Available since v1.287.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") || "terraform-example";
    const _default = new alicloud.log.Project("default", {
        projectName: name,
        description: "example project for account logging",
    });
    const defaultStore = new alicloud.log.Store("default", {
        projectName: _default.projectName,
        logstoreName: name,
        retentionPeriod: 30,
        shardCount: 2,
    });
    const defaultServiceAccountLogging = new alicloud.message.ServiceAccountLogging("default", {
        logEnabled: true,
        messageTraceEnabled: false,
        projectName: _default.projectName,
        logStoreName: defaultStore.logstoreName,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    
    config = pulumi.Config()
    name = config.get("name")
    if name is None:
        name = "terraform-example"
    default = alicloud.log.Project("default",
        project_name=name,
        description="example project for account logging")
    default_store = alicloud.log.Store("default",
        project_name=default.project_name,
        logstore_name=name,
        retention_period=30,
        shard_count=2)
    default_service_account_logging = alicloud.message.ServiceAccountLogging("default",
        log_enabled=True,
        message_trace_enabled=False,
        project_name=default.project_name,
        log_store_name=default_store.logstore_name)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/log"
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/message"
    	"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 := "terraform-example"
    		if param := cfg.Get("name"); param != "" {
    			name = param
    		}
    		_default, err := log.NewProject(ctx, "default", &log.ProjectArgs{
    			ProjectName: pulumi.String(name),
    			Description: pulumi.String("example project for account logging"),
    		})
    		if err != nil {
    			return err
    		}
    		defaultStore, err := log.NewStore(ctx, "default", &log.StoreArgs{
    			ProjectName:     _default.ProjectName,
    			LogstoreName:    pulumi.String(name),
    			RetentionPeriod: pulumi.Int(30),
    			ShardCount:      pulumi.Int(2),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = message.NewServiceAccountLogging(ctx, "default", &message.ServiceAccountLoggingArgs{
    			LogEnabled:          pulumi.Bool(true),
    			MessageTraceEnabled: pulumi.Bool(false),
    			ProjectName:         _default.ProjectName,
    			LogStoreName:        defaultStore.LogstoreName,
    		})
    		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") ?? "terraform-example";
        var @default = new AliCloud.Log.Project("default", new()
        {
            ProjectName = name,
            Description = "example project for account logging",
        });
    
        var defaultStore = new AliCloud.Log.Store("default", new()
        {
            ProjectName = @default.ProjectName,
            LogstoreName = name,
            RetentionPeriod = 30,
            ShardCount = 2,
        });
    
        var defaultServiceAccountLogging = new AliCloud.Message.ServiceAccountLogging("default", new()
        {
            LogEnabled = true,
            MessageTraceEnabled = false,
            ProjectName = @default.ProjectName,
            LogStoreName = defaultStore.LogstoreName,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.alicloud.log.Project;
    import com.pulumi.alicloud.log.ProjectArgs;
    import com.pulumi.alicloud.log.Store;
    import com.pulumi.alicloud.log.StoreArgs;
    import com.pulumi.alicloud.message.ServiceAccountLogging;
    import com.pulumi.alicloud.message.ServiceAccountLoggingArgs;
    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("terraform-example");
            var default_ = new Project("default", ProjectArgs.builder()
                .projectName(name)
                .description("example project for account logging")
                .build());
    
            var defaultStore = new Store("defaultStore", StoreArgs.builder()
                .projectName(default_.projectName())
                .logstoreName(name)
                .retentionPeriod(30)
                .shardCount(2)
                .build());
    
            var defaultServiceAccountLogging = new ServiceAccountLogging("defaultServiceAccountLogging", ServiceAccountLoggingArgs.builder()
                .logEnabled(true)
                .messageTraceEnabled(false)
                .projectName(default_.projectName())
                .logStoreName(defaultStore.logstoreName())
                .build());
    
        }
    }
    
    configuration:
      name:
        type: string
        default: terraform-example
    resources:
      default:
        type: alicloud:log:Project
        properties:
          projectName: ${name}
          description: example project for account logging
      defaultStore:
        type: alicloud:log:Store
        name: default
        properties:
          projectName: ${default.projectName}
          logstoreName: ${name}
          retentionPeriod: 30
          shardCount: 2
      defaultServiceAccountLogging:
        type: alicloud:message:ServiceAccountLogging
        name: default
        properties:
          logEnabled: true
          messageTraceEnabled: false
          projectName: ${default.projectName}
          logStoreName: ${defaultStore.logstoreName}
    
    pulumi {
      required_providers {
        alicloud = {
          source = "pulumi/alicloud"
        }
      }
    }
    
    resource "alicloud_log_project" "default" {
      project_name = var.name
      description  = "example project for account logging"
    }
    resource "alicloud_log_store" "default" {
      project_name     = alicloud_log_project.default.project_name
      logstore_name    = var.name
      retention_period = 30
      shard_count      = 2
    }
    resource "alicloud_message_serviceaccountlogging" "default" {
      log_enabled           = true
      message_trace_enabled = false
      project_name          = alicloud_log_project.default.project_name
      log_store_name        = alicloud_log_store.default.logstore_name
    }
    variable "name" {
      type    = string
      default = "terraform-example"
    }
    

    Deleting alicloud.message.ServiceAccountLogging or removing it from your configuration

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

    📚 Need more examples? VIEW MORE EXAMPLES

    Create ServiceAccountLogging Resource

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

    Constructor syntax

    new ServiceAccountLogging(name: string, args: ServiceAccountLoggingArgs, opts?: CustomResourceOptions);
    @overload
    def ServiceAccountLogging(resource_name: str,
                              args: ServiceAccountLoggingArgs,
                              opts: Optional[ResourceOptions] = None)
    
    @overload
    def ServiceAccountLogging(resource_name: str,
                              opts: Optional[ResourceOptions] = None,
                              log_enabled: Optional[bool] = None,
                              log_store_name: Optional[str] = None,
                              message_trace_enabled: Optional[bool] = None,
                              project_name: Optional[str] = None)
    func NewServiceAccountLogging(ctx *Context, name string, args ServiceAccountLoggingArgs, opts ...ResourceOption) (*ServiceAccountLogging, error)
    public ServiceAccountLogging(string name, ServiceAccountLoggingArgs args, CustomResourceOptions? opts = null)
    public ServiceAccountLogging(String name, ServiceAccountLoggingArgs args)
    public ServiceAccountLogging(String name, ServiceAccountLoggingArgs args, CustomResourceOptions options)
    
    type: alicloud:message:ServiceAccountLogging
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    resource "alicloud_message_service_account_logging" "name" {
        # resource properties
    }

    Parameters

    name string
    The unique name of the resource.
    args ServiceAccountLoggingArgs
    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 ServiceAccountLoggingArgs
    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 ServiceAccountLoggingArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ServiceAccountLoggingArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ServiceAccountLoggingArgs
    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 serviceAccountLoggingResource = new AliCloud.Message.ServiceAccountLogging("serviceAccountLoggingResource", new()
    {
        LogEnabled = false,
        LogStoreName = "string",
        MessageTraceEnabled = false,
        ProjectName = "string",
    });
    
    example, err := message.NewServiceAccountLogging(ctx, "serviceAccountLoggingResource", &message.ServiceAccountLoggingArgs{
    	LogEnabled:          pulumi.Bool(false),
    	LogStoreName:        pulumi.String("string"),
    	MessageTraceEnabled: pulumi.Bool(false),
    	ProjectName:         pulumi.String("string"),
    })
    
    resource "alicloud_message_service_account_logging" "serviceAccountLoggingResource" {
      lifecycle {
        create_before_destroy = true
      }
      log_enabled           = false
      log_store_name        = "string"
      message_trace_enabled = false
      project_name          = "string"
    }
    
    var serviceAccountLoggingResource = new ServiceAccountLogging("serviceAccountLoggingResource", ServiceAccountLoggingArgs.builder()
        .logEnabled(false)
        .logStoreName("string")
        .messageTraceEnabled(false)
        .projectName("string")
        .build());
    
    service_account_logging_resource = alicloud.message.ServiceAccountLogging("serviceAccountLoggingResource",
        log_enabled=False,
        log_store_name="string",
        message_trace_enabled=False,
        project_name="string")
    
    const serviceAccountLoggingResource = new alicloud.message.ServiceAccountLogging("serviceAccountLoggingResource", {
        logEnabled: false,
        logStoreName: "string",
        messageTraceEnabled: false,
        projectName: "string",
    });
    
    type: alicloud:message:ServiceAccountLogging
    properties:
        logEnabled: false
        logStoreName: string
        messageTraceEnabled: false
        projectName: string
    

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

    LogEnabled bool
    Whether to enable delivering the account operation logs to Simple Log Service (SLS).
    LogStoreName string
    The name of the SLS Logstore that receives the logs. Required when logEnabled is true.
    MessageTraceEnabled bool
    Whether to enable the message trace feature.
    ProjectName string
    The name of the SLS Project that the Logstore belongs to. Required when logEnabled is true.
    LogEnabled bool
    Whether to enable delivering the account operation logs to Simple Log Service (SLS).
    LogStoreName string
    The name of the SLS Logstore that receives the logs. Required when logEnabled is true.
    MessageTraceEnabled bool
    Whether to enable the message trace feature.
    ProjectName string
    The name of the SLS Project that the Logstore belongs to. Required when logEnabled is true.
    log_enabled bool
    Whether to enable delivering the account operation logs to Simple Log Service (SLS).
    log_store_name string
    The name of the SLS Logstore that receives the logs. Required when logEnabled is true.
    message_trace_enabled bool
    Whether to enable the message trace feature.
    project_name string
    The name of the SLS Project that the Logstore belongs to. Required when logEnabled is true.
    logEnabled Boolean
    Whether to enable delivering the account operation logs to Simple Log Service (SLS).
    logStoreName String
    The name of the SLS Logstore that receives the logs. Required when logEnabled is true.
    messageTraceEnabled Boolean
    Whether to enable the message trace feature.
    projectName String
    The name of the SLS Project that the Logstore belongs to. Required when logEnabled is true.
    logEnabled boolean
    Whether to enable delivering the account operation logs to Simple Log Service (SLS).
    logStoreName string
    The name of the SLS Logstore that receives the logs. Required when logEnabled is true.
    messageTraceEnabled boolean
    Whether to enable the message trace feature.
    projectName string
    The name of the SLS Project that the Logstore belongs to. Required when logEnabled is true.
    log_enabled bool
    Whether to enable delivering the account operation logs to Simple Log Service (SLS).
    log_store_name str
    The name of the SLS Logstore that receives the logs. Required when logEnabled is true.
    message_trace_enabled bool
    Whether to enable the message trace feature.
    project_name str
    The name of the SLS Project that the Logstore belongs to. Required when logEnabled is true.
    logEnabled Boolean
    Whether to enable delivering the account operation logs to Simple Log Service (SLS).
    logStoreName String
    The name of the SLS Logstore that receives the logs. Required when logEnabled is true.
    messageTraceEnabled Boolean
    Whether to enable the message trace feature.
    projectName String
    The name of the SLS Project that the Logstore belongs to. Required when logEnabled is true.

    Outputs

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

    Get an existing ServiceAccountLogging 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?: ServiceAccountLoggingState, opts?: CustomResourceOptions): ServiceAccountLogging
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            log_enabled: Optional[bool] = None,
            log_store_name: Optional[str] = None,
            message_trace_enabled: Optional[bool] = None,
            project_name: Optional[str] = None) -> ServiceAccountLogging
    func GetServiceAccountLogging(ctx *Context, name string, id IDInput, state *ServiceAccountLoggingState, opts ...ResourceOption) (*ServiceAccountLogging, error)
    public static ServiceAccountLogging Get(string name, Input<string> id, ServiceAccountLoggingState? state, CustomResourceOptions? opts = null)
    public static ServiceAccountLogging get(String name, Output<String> id, ServiceAccountLoggingState state, CustomResourceOptions options)
    resources:  _:    type: alicloud:message:ServiceAccountLogging    get:      id: ${id}
    import {
      to = alicloud_message_service_account_logging.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:
    LogEnabled bool
    Whether to enable delivering the account operation logs to Simple Log Service (SLS).
    LogStoreName string
    The name of the SLS Logstore that receives the logs. Required when logEnabled is true.
    MessageTraceEnabled bool
    Whether to enable the message trace feature.
    ProjectName string
    The name of the SLS Project that the Logstore belongs to. Required when logEnabled is true.
    LogEnabled bool
    Whether to enable delivering the account operation logs to Simple Log Service (SLS).
    LogStoreName string
    The name of the SLS Logstore that receives the logs. Required when logEnabled is true.
    MessageTraceEnabled bool
    Whether to enable the message trace feature.
    ProjectName string
    The name of the SLS Project that the Logstore belongs to. Required when logEnabled is true.
    log_enabled bool
    Whether to enable delivering the account operation logs to Simple Log Service (SLS).
    log_store_name string
    The name of the SLS Logstore that receives the logs. Required when logEnabled is true.
    message_trace_enabled bool
    Whether to enable the message trace feature.
    project_name string
    The name of the SLS Project that the Logstore belongs to. Required when logEnabled is true.
    logEnabled Boolean
    Whether to enable delivering the account operation logs to Simple Log Service (SLS).
    logStoreName String
    The name of the SLS Logstore that receives the logs. Required when logEnabled is true.
    messageTraceEnabled Boolean
    Whether to enable the message trace feature.
    projectName String
    The name of the SLS Project that the Logstore belongs to. Required when logEnabled is true.
    logEnabled boolean
    Whether to enable delivering the account operation logs to Simple Log Service (SLS).
    logStoreName string
    The name of the SLS Logstore that receives the logs. Required when logEnabled is true.
    messageTraceEnabled boolean
    Whether to enable the message trace feature.
    projectName string
    The name of the SLS Project that the Logstore belongs to. Required when logEnabled is true.
    log_enabled bool
    Whether to enable delivering the account operation logs to Simple Log Service (SLS).
    log_store_name str
    The name of the SLS Logstore that receives the logs. Required when logEnabled is true.
    message_trace_enabled bool
    Whether to enable the message trace feature.
    project_name str
    The name of the SLS Project that the Logstore belongs to. Required when logEnabled is true.
    logEnabled Boolean
    Whether to enable delivering the account operation logs to Simple Log Service (SLS).
    logStoreName String
    The name of the SLS Logstore that receives the logs. Required when logEnabled is true.
    messageTraceEnabled Boolean
    Whether to enable the message trace feature.
    projectName String
    The name of the SLS Project that the Logstore belongs to. Required when logEnabled is true.

    Import

    Message Service Account Logging can be imported using the id, e.g.

    $ terraform import alicloud_message_service_account_logging.example <Alibaba Cloud Account 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.106.0
    published on Monday, Aug 24, 2026 by Pulumi

      Try Pulumi Cloud free.
      Your team will thank you.

      Start free trial