1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. log
  5. LogTailConfig
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 2024 by Pulumi

alicloud.log.LogTailConfig

Explore with Pulumi AI

alicloud logo
Alibaba Cloud v3.66.0 published on Friday, Nov 15, 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.index.Integer("default", {
        max: 99999,
        min: 10000,
    });
    const example = new alicloud.log.Project("example", {
        projectName: `terraform-example-${_default.result}`,
        description: "terraform-example",
    });
    const exampleStore = new alicloud.log.Store("example", {
        projectName: example.projectName,
        logstoreName: "example-store",
        retentionPeriod: 3650,
        shardCount: 3,
        autoSplit: true,
        maxSplitShardCount: 60,
        appendMeta: true,
    });
    const exampleLogTailConfig = new alicloud.log.LogTailConfig("example", {
        project: example.projectName,
        logstore: exampleStore.logstoreName,
        inputType: "file",
        name: "terraform-example",
        outputType: "LogService",
        inputDetail: `  \x09{
    \x09\x09"logPath": "/logPath",
    \x09\x09"filePattern": "access.log",
    \x09\x09"logType": "json_log",
    \x09\x09"topicFormat": "default",
    \x09\x09"discardUnmatch": false,
    \x09\x09"enableRawLog": true,
    \x09\x09"fileEncoding": "gbk",
    \x09\x09"maxDepth": 10
    \x09}
    `,
    });
    
    import pulumi
    import pulumi_alicloud as alicloud
    import pulumi_random as random
    
    default = random.index.Integer("default",
        max=99999,
        min=10000)
    example = alicloud.log.Project("example",
        project_name=f"terraform-example-{default['result']}",
        description="terraform-example")
    example_store = alicloud.log.Store("example",
        project_name=example.project_name,
        logstore_name="example-store",
        retention_period=3650,
        shard_count=3,
        auto_split=True,
        max_split_shard_count=60,
        append_meta=True)
    example_log_tail_config = alicloud.log.LogTailConfig("example",
        project=example.project_name,
        logstore=example_store.logstore_name,
        input_type="file",
        name="terraform-example",
        output_type="LogService",
        input_detail="""  \x09{
    \x09\x09"logPath": "/logPath",
    \x09\x09"filePattern": "access.log",
    \x09\x09"logType": "json_log",
    \x09\x09"topicFormat": "default",
    \x09\x09"discardUnmatch": false,
    \x09\x09"enableRawLog": true,
    \x09\x09"fileEncoding": "gbk",
    \x09\x09"maxDepth": 10
    \x09}
    """)
    
    package main
    
    import (
    	"fmt"
    
    	"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.NewInteger(ctx, "default", &random.IntegerArgs{
    			Max: 99999,
    			Min: 10000,
    		})
    		if err != nil {
    			return err
    		}
    		example, err := log.NewProject(ctx, "example", &log.ProjectArgs{
    			ProjectName: pulumi.Sprintf("terraform-example-%v", _default.Result),
    			Description: pulumi.String("terraform-example"),
    		})
    		if err != nil {
    			return err
    		}
    		exampleStore, err := log.NewStore(ctx, "example", &log.StoreArgs{
    			ProjectName:        example.ProjectName,
    			LogstoreName:       pulumi.String("example-store"),
    			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, "example", &log.LogTailConfigArgs{
    			Project:    example.ProjectName,
    			Logstore:   exampleStore.LogstoreName,
    			InputType:  pulumi.String("file"),
    			Name:       pulumi.String("terraform-example"),
    			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.Index.Integer("default", new()
        {
            Max = 99999,
            Min = 10000,
        });
    
        var example = new AliCloud.Log.Project("example", new()
        {
            ProjectName = $"terraform-example-{@default.Result}",
            Description = "terraform-example",
        });
    
        var exampleStore = new AliCloud.Log.Store("example", new()
        {
            ProjectName = example.ProjectName,
            LogstoreName = "example-store",
            RetentionPeriod = 3650,
            ShardCount = 3,
            AutoSplit = true,
            MaxSplitShardCount = 60,
            AppendMeta = true,
        });
    
        var exampleLogTailConfig = new AliCloud.Log.LogTailConfig("example", new()
        {
            Project = example.ProjectName,
            Logstore = exampleStore.LogstoreName,
            InputType = "file",
            Name = "terraform-example",
            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.integer;
    import com.pulumi.random.IntegerArgs;
    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 Integer("default", IntegerArgs.builder()
                .max(99999)
                .min(10000)
                .build());
    
            var example = new Project("example", ProjectArgs.builder()
                .projectName(String.format("terraform-example-%s", default_.result()))
                .description("terraform-example")
                .build());
    
            var exampleStore = new Store("exampleStore", StoreArgs.builder()
                .projectName(example.projectName())
                .logstoreName("example-store")
                .retentionPeriod(3650)
                .shardCount(3)
                .autoSplit(true)
                .maxSplitShardCount(60)
                .appendMeta(true)
                .build());
    
            var exampleLogTailConfig = new LogTailConfig("exampleLogTailConfig", LogTailConfigArgs.builder()
                .project(example.projectName())
                .logstore(exampleStore.logstoreName())
                .inputType("file")
                .name("terraform-example")
                .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:integer
        properties:
          max: 99999
          min: 10000
      example:
        type: alicloud:log:Project
        properties:
          projectName: terraform-example-${default.result}
          description: terraform-example
      exampleStore:
        type: alicloud:log:Store
        name: example
        properties:
          projectName: ${example.projectName}
          logstoreName: example-store
          retentionPeriod: 3650
          shardCount: 3
          autoSplit: true
          maxSplitShardCount: 60
          appendMeta: true
      exampleLogTailConfig:
        type: alicloud:log:LogTailConfig
        name: example
        properties:
          project: ${example.projectName}
          logstore: ${exampleStore.logstoreName}
          inputType: file
          name: terraform-example
          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.

    Constructor 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

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    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.66.0 published on Friday, Nov 15, 2024 by Pulumi