1. Packages
  2. Alibaba Cloud
  3. API Docs
  4. log
  5. LogTailConfig
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

alicloud.log.LogTailConfig

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi

    The Logtail access service is a log collection agent provided by Log Service. You can use Logtail to collect logs from servers such as Alibaba Cloud Elastic Compute Service (ECS) instances in real time in the Log Service console. Refer to details

    NOTE: Available since v1.93.0.

    Example Usage

    Basic Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as alicloud from "@pulumi/alicloud";
    import * as random from "@pulumi/random";
    
    const _default = new random.RandomInteger("default", {
        max: 99999,
        min: 10000,
    });
    const exampleProject = new alicloud.log.Project("exampleProject", {description: "terraform-example"});
    const exampleStore = new alicloud.log.Store("exampleStore", {
        project: exampleProject.name,
        retentionPeriod: 3650,
        shardCount: 3,
        autoSplit: true,
        maxSplitShardCount: 60,
        appendMeta: true,
    });
    const exampleLogTailConfig = new alicloud.log.LogTailConfig("exampleLogTailConfig", {
        project: exampleProject.name,
        logstore: exampleStore.name,
        inputType: "file",
        outputType: "LogService",
        inputDetail: `  	{
    		"logPath": "/logPath",
    		"filePattern": "access.log",
    		"logType": "json_log",
    		"topicFormat": "default",
    		"discardUnmatch": false,
    		"enableRawLog": true,
    		"fileEncoding": "gbk",
    		"maxDepth": 10
    	}
    `,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    import pulumi_random as random
    
    default = random.RandomInteger("default",
        max=99999,
        min=10000)
    example_project = alicloud.log.Project("exampleProject", description="terraform-example")
    example_store = alicloud.log.Store("exampleStore",
        project=example_project.name,
        retention_period=3650,
        shard_count=3,
        auto_split=True,
        max_split_shard_count=60,
        append_meta=True)
    example_log_tail_config = alicloud.log.LogTailConfig("exampleLogTailConfig",
        project=example_project.name,
        logstore=example_store.name,
        input_type="file",
        output_type="LogService",
        input_detail="""  	{
    		"logPath": "/logPath",
    		"filePattern": "access.log",
    		"logType": "json_log",
    		"topicFormat": "default",
    		"discardUnmatch": false,
    		"enableRawLog": true,
    		"fileEncoding": "gbk",
    		"maxDepth": 10
    	}
    """)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/log"
    	"github.com/pulumi/pulumi-random/sdk/v4/go/random"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := random.NewRandomInteger(ctx, "default", &random.RandomIntegerArgs{
    			Max: pulumi.Int(99999),
    			Min: pulumi.Int(10000),
    		})
    		if err != nil {
    			return err
    		}
    		exampleProject, err := log.NewProject(ctx, "exampleProject", &log.ProjectArgs{
    			Description: pulumi.String("terraform-example"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleStore, err := log.NewStore(ctx, "exampleStore", &log.StoreArgs{
    			Project:            exampleProject.Name,
    			RetentionPeriod:    pulumi.Int(3650),
    			ShardCount:         pulumi.Int(3),
    			AutoSplit:          pulumi.Bool(true),
    			MaxSplitShardCount: pulumi.Int(60),
    			AppendMeta:         pulumi.Bool(true),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = log.NewLogTailConfig(ctx, "exampleLogTailConfig", &log.LogTailConfigArgs{
    			Project:    exampleProject.Name,
    			Logstore:   exampleStore.Name,
    			InputType:  pulumi.String("file"),
    			OutputType: pulumi.String("LogService"),
    			InputDetail: pulumi.String(`  	{
    		"logPath": "/logPath",
    		"filePattern": "access.log",
    		"logType": "json_log",
    		"topicFormat": "default",
    		"discardUnmatch": false,
    		"enableRawLog": true,
    		"fileEncoding": "gbk",
    		"maxDepth": 10
    	}
    `),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using AliCloud = Pulumi.AliCloud;
    using Random = Pulumi.Random;
    
    return await Deployment.RunAsync(() => 
    {
        var @default = new Random.RandomInteger("default", new()
        {
            Max = 99999,
            Min = 10000,
        });
    
        var exampleProject = new AliCloud.Log.Project("exampleProject", new()
        {
            Description = "terraform-example",
        });
    
        var exampleStore = new AliCloud.Log.Store("exampleStore", new()
        {
            Project = exampleProject.Name,
            RetentionPeriod = 3650,
            ShardCount = 3,
            AutoSplit = true,
            MaxSplitShardCount = 60,
            AppendMeta = true,
        });
    
        var exampleLogTailConfig = new AliCloud.Log.LogTailConfig("exampleLogTailConfig", new()
        {
            Project = exampleProject.Name,
            Logstore = exampleStore.Name,
            InputType = "file",
            OutputType = "LogService",
            InputDetail = @"  	{
    		""logPath"": ""/logPath"",
    		""filePattern"": ""access.log"",
    		""logType"": ""json_log"",
    		""topicFormat"": ""default"",
    		""discardUnmatch"": false,
    		""enableRawLog"": true,
    		""fileEncoding"": ""gbk"",
    		""maxDepth"": 10
    	}
    ",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.random.RandomInteger;
    import com.pulumi.random.RandomIntegerArgs;
    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.log.LogTailConfig;
    import com.pulumi.alicloud.log.LogTailConfigArgs;
    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 default_ = new RandomInteger("default", RandomIntegerArgs.builder()        
                .max(99999)
                .min(10000)
                .build());
    
            var exampleProject = new Project("exampleProject", ProjectArgs.builder()        
                .description("terraform-example")
                .build());
    
            var exampleStore = new Store("exampleStore", StoreArgs.builder()        
                .project(exampleProject.name())
                .retentionPeriod(3650)
                .shardCount(3)
                .autoSplit(true)
                .maxSplitShardCount(60)
                .appendMeta(true)
                .build());
    
            var exampleLogTailConfig = new LogTailConfig("exampleLogTailConfig", LogTailConfigArgs.builder()        
                .project(exampleProject.name())
                .logstore(exampleStore.name())
                .inputType("file")
                .outputType("LogService")
                .inputDetail("""
      	{
    		"logPath": "/logPath",
    		"filePattern": "access.log",
    		"logType": "json_log",
    		"topicFormat": "default",
    		"discardUnmatch": false,
    		"enableRawLog": true,
    		"fileEncoding": "gbk",
    		"maxDepth": 10
    	}
                """)
                .build());
    
        }
    }
    
    resources:
      default:
        type: random:RandomInteger
        properties:
          max: 99999
          min: 10000
      exampleProject:
        type: alicloud:log:Project
        properties:
          description: terraform-example
      exampleStore:
        type: alicloud:log:Store
        properties:
          project: ${exampleProject.name}
          retentionPeriod: 3650
          shardCount: 3
          autoSplit: true
          maxSplitShardCount: 60
          appendMeta: true
      exampleLogTailConfig:
        type: alicloud:log:LogTailConfig
        properties:
          project: ${exampleProject.name}
          logstore: ${exampleStore.name}
          inputType: file
          outputType: LogService
          inputDetail: |2
              	{
            		"logPath": "/logPath",
            		"filePattern": "access.log",
            		"logType": "json_log",
            		"topicFormat": "default",
            		"discardUnmatch": false,
            		"enableRawLog": true,
            		"fileEncoding": "gbk",
            		"maxDepth": 10
            	}
    

    Module Support

    You can use the existing sls-logtail module to create logtail config, machine group, install logtail on ECS instances and join instances into machine group one-click.

    Create LogTailConfig Resource

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

    Constructor syntax

    new LogTailConfig(name: string, args: LogTailConfigArgs, opts?: CustomResourceOptions);
    @overload
    def LogTailConfig(resource_name: str,
                      args: LogTailConfigArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def LogTailConfig(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      input_detail: Optional[str] = None,
                      input_type: Optional[str] = None,
                      logstore: Optional[str] = None,
                      output_type: Optional[str] = None,
                      project: Optional[str] = None,
                      log_sample: Optional[str] = None,
                      name: Optional[str] = None)
    func NewLogTailConfig(ctx *Context, name string, args LogTailConfigArgs, opts ...ResourceOption) (*LogTailConfig, error)
    public LogTailConfig(string name, LogTailConfigArgs args, CustomResourceOptions? opts = null)
    public LogTailConfig(String name, LogTailConfigArgs args)
    public LogTailConfig(String name, LogTailConfigArgs args, CustomResourceOptions options)
    
    type: alicloud:log:LogTailConfig
    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 LogTailConfigArgs
    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 LogTailConfigArgs
    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 LogTailConfigArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args LogTailConfigArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args LogTailConfigArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

    The following reference example uses placeholder values for all input properties.

    var logTailConfigResource = new AliCloud.Log.LogTailConfig("logTailConfigResource", new()
    {
        InputDetail = "string",
        InputType = "string",
        Logstore = "string",
        OutputType = "string",
        Project = "string",
        LogSample = "string",
        Name = "string",
    });
    
    example, err := log.NewLogTailConfig(ctx, "logTailConfigResource", &log.LogTailConfigArgs{
    	InputDetail: pulumi.String("string"),
    	InputType:   pulumi.String("string"),
    	Logstore:    pulumi.String("string"),
    	OutputType:  pulumi.String("string"),
    	Project:     pulumi.String("string"),
    	LogSample:   pulumi.String("string"),
    	Name:        pulumi.String("string"),
    })
    
    var logTailConfigResource = new LogTailConfig("logTailConfigResource", LogTailConfigArgs.builder()        
        .inputDetail("string")
        .inputType("string")
        .logstore("string")
        .outputType("string")
        .project("string")
        .logSample("string")
        .name("string")
        .build());
    
    log_tail_config_resource = alicloud.log.LogTailConfig("logTailConfigResource",
        input_detail="string",
        input_type="string",
        logstore="string",
        output_type="string",
        project="string",
        log_sample="string",
        name="string")
    
    const logTailConfigResource = new alicloud.log.LogTailConfig("logTailConfigResource", {
        inputDetail: "string",
        inputType: "string",
        logstore: "string",
        outputType: "string",
        project: "string",
        logSample: "string",
        name: "string",
    });
    
    type: alicloud:log:LogTailConfig
    properties:
        inputDetail: string
        inputType: string
        logSample: string
        logstore: string
        name: string
        outputType: string
        project: string
    

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

    InputDetail string
    The logtail configure the required JSON files. (Refer to details)
    InputType string
    The input type. Currently only two types of files and plugin are supported.
    Logstore string
    The log store name to the query index belongs.
    OutputType string
    The output type. Currently, only LogService is supported.
    Project string
    The project name to the log store belongs.
    LogSample string
    The log sample of the Logtail configuration. The log size cannot exceed 1,000 bytes.
    Name string
    The Logtail configuration name, which is unique in the same project.
    InputDetail string
    The logtail configure the required JSON files. (Refer to details)
    InputType string
    The input type. Currently only two types of files and plugin are supported.
    Logstore string
    The log store name to the query index belongs.
    OutputType string
    The output type. Currently, only LogService is supported.
    Project string
    The project name to the log store belongs.
    LogSample string
    The log sample of the Logtail configuration. The log size cannot exceed 1,000 bytes.
    Name string
    The Logtail configuration name, which is unique in the same project.
    inputDetail String
    The logtail configure the required JSON files. (Refer to details)
    inputType String
    The input type. Currently only two types of files and plugin are supported.
    logstore String
    The log store name to the query index belongs.
    outputType String
    The output type. Currently, only LogService is supported.
    project String
    The project name to the log store belongs.
    logSample String
    The log sample of the Logtail configuration. The log size cannot exceed 1,000 bytes.
    name String
    The Logtail configuration name, which is unique in the same project.
    inputDetail string
    The logtail configure the required JSON files. (Refer to details)
    inputType string
    The input type. Currently only two types of files and plugin are supported.
    logstore string
    The log store name to the query index belongs.
    outputType string
    The output type. Currently, only LogService is supported.
    project string
    The project name to the log store belongs.
    logSample string
    The log sample of the Logtail configuration. The log size cannot exceed 1,000 bytes.
    name string
    The Logtail configuration name, which is unique in the same project.
    input_detail str
    The logtail configure the required JSON files. (Refer to details)
    input_type str
    The input type. Currently only two types of files and plugin are supported.
    logstore str
    The log store name to the query index belongs.
    output_type str
    The output type. Currently, only LogService is supported.
    project str
    The project name to the log store belongs.
    log_sample str
    The log sample of the Logtail configuration. The log size cannot exceed 1,000 bytes.
    name str
    The Logtail configuration name, which is unique in the same project.
    inputDetail String
    The logtail configure the required JSON files. (Refer to details)
    inputType String
    The input type. Currently only two types of files and plugin are supported.
    logstore String
    The log store name to the query index belongs.
    outputType String
    The output type. Currently, only LogService is supported.
    project String
    The project name to the log store belongs.
    logSample String
    The log sample of the Logtail configuration. The log size cannot exceed 1,000 bytes.
    name String
    The Logtail configuration name, which is unique in the same project.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    LastModifyTime string
    This parameter is auto generated by server, please do not fill in.
    Id string
    The provider-assigned unique ID for this managed resource.
    LastModifyTime string
    This parameter is auto generated by server, please do not fill in.
    id String
    The provider-assigned unique ID for this managed resource.
    lastModifyTime String
    This parameter is auto generated by server, please do not fill in.
    id string
    The provider-assigned unique ID for this managed resource.
    lastModifyTime string
    This parameter is auto generated by server, please do not fill in.
    id str
    The provider-assigned unique ID for this managed resource.
    last_modify_time str
    This parameter is auto generated by server, please do not fill in.
    id String
    The provider-assigned unique ID for this managed resource.
    lastModifyTime String
    This parameter is auto generated by server, please do not fill in.

    Look up Existing LogTailConfig Resource

    Get an existing LogTailConfig 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?: LogTailConfigState, opts?: CustomResourceOptions): LogTailConfig
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            input_detail: Optional[str] = None,
            input_type: Optional[str] = None,
            last_modify_time: Optional[str] = None,
            log_sample: Optional[str] = None,
            logstore: Optional[str] = None,
            name: Optional[str] = None,
            output_type: Optional[str] = None,
            project: Optional[str] = None) -> LogTailConfig
    func GetLogTailConfig(ctx *Context, name string, id IDInput, state *LogTailConfigState, opts ...ResourceOption) (*LogTailConfig, error)
    public static LogTailConfig Get(string name, Input<string> id, LogTailConfigState? state, CustomResourceOptions? opts = null)
    public static LogTailConfig get(String name, Output<String> id, LogTailConfigState 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:
    InputDetail string
    The logtail configure the required JSON files. (Refer to details)
    InputType string
    The input type. Currently only two types of files and plugin are supported.
    LastModifyTime string
    This parameter is auto generated by server, please do not fill in.
    LogSample string
    The log sample of the Logtail configuration. The log size cannot exceed 1,000 bytes.
    Logstore string
    The log store name to the query index belongs.
    Name string
    The Logtail configuration name, which is unique in the same project.
    OutputType string
    The output type. Currently, only LogService is supported.
    Project string
    The project name to the log store belongs.
    InputDetail string
    The logtail configure the required JSON files. (Refer to details)
    InputType string
    The input type. Currently only two types of files and plugin are supported.
    LastModifyTime string
    This parameter is auto generated by server, please do not fill in.
    LogSample string
    The log sample of the Logtail configuration. The log size cannot exceed 1,000 bytes.
    Logstore string
    The log store name to the query index belongs.
    Name string
    The Logtail configuration name, which is unique in the same project.
    OutputType string
    The output type. Currently, only LogService is supported.
    Project string
    The project name to the log store belongs.
    inputDetail String
    The logtail configure the required JSON files. (Refer to details)
    inputType String
    The input type. Currently only two types of files and plugin are supported.
    lastModifyTime String
    This parameter is auto generated by server, please do not fill in.
    logSample String
    The log sample of the Logtail configuration. The log size cannot exceed 1,000 bytes.
    logstore String
    The log store name to the query index belongs.
    name String
    The Logtail configuration name, which is unique in the same project.
    outputType String
    The output type. Currently, only LogService is supported.
    project String
    The project name to the log store belongs.
    inputDetail string
    The logtail configure the required JSON files. (Refer to details)
    inputType string
    The input type. Currently only two types of files and plugin are supported.
    lastModifyTime string
    This parameter is auto generated by server, please do not fill in.
    logSample string
    The log sample of the Logtail configuration. The log size cannot exceed 1,000 bytes.
    logstore string
    The log store name to the query index belongs.
    name string
    The Logtail configuration name, which is unique in the same project.
    outputType string
    The output type. Currently, only LogService is supported.
    project string
    The project name to the log store belongs.
    input_detail str
    The logtail configure the required JSON files. (Refer to details)
    input_type str
    The input type. Currently only two types of files and plugin are supported.
    last_modify_time str
    This parameter is auto generated by server, please do not fill in.
    log_sample str
    The log sample of the Logtail configuration. The log size cannot exceed 1,000 bytes.
    logstore str
    The log store name to the query index belongs.
    name str
    The Logtail configuration name, which is unique in the same project.
    output_type str
    The output type. Currently, only LogService is supported.
    project str
    The project name to the log store belongs.
    inputDetail String
    The logtail configure the required JSON files. (Refer to details)
    inputType String
    The input type. Currently only two types of files and plugin are supported.
    lastModifyTime String
    This parameter is auto generated by server, please do not fill in.
    logSample String
    The log sample of the Logtail configuration. The log size cannot exceed 1,000 bytes.
    logstore String
    The log store name to the query index belongs.
    name String
    The Logtail configuration name, which is unique in the same project.
    outputType String
    The output type. Currently, only LogService is supported.
    project String
    The project name to the log store belongs.

    Import

    Logtial config can be imported using the id, e.g.

    $ pulumi import alicloud:log/logTailConfig:LogTailConfig example tf-log:tf-log-store:tf-log-config
    

    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
    Alibaba Cloud v3.53.0 published on Wednesday, Apr 17, 2024 by Pulumi