alicloud_logtail_config

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

Example Usage

Basic Usage

resource "random_integer" "default" {
  max = 99999
  min = 10000
}

resource "alicloud_log_project" "example" {
  name        = "terraform-example-${random_integer.default.result}"
  description = "terraform-example"
}

resource "alicloud_log_store" "example" {
  project               = alicloud_log_project.example.name
  name                  = "example-store"
  retention_period      = 3650
  shard_count           = 3
  auto_split            = true
  max_split_shard_count = 60
  append_meta           = true
}

resource "alicloud_logtail_config" "example" {
  project      = alicloud_log_project.example.name
  logstore     = alicloud_log_store.example.name
  input_type   = "file"
  name         = "terraform-example"
  output_type  = "LogService"
  input_detail = <<DEFINITION
    {
        "logPath": "/logPath",
        "filePattern": "access.log",
        "logType": "json_log",
        "topicFormat": "default",
        "discardUnmatch": false,
        "enableRawLog": true,
        "fileEncoding": "gbk",
        "maxDepth": 10
    }
  DEFINITION
}
    {
        "logPath": "/logPath",
        "filePattern": "access.log",
        "logType": "json_log",
        "topicFormat": "default",
        "discardUnmatch": false,
        "enableRawLog": true,
        "fileEncoding": "gbk",
        "maxDepth": 10
    }
  DEFINITION
}

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.

Argument Reference

The following arguments are supported:

Attributes Reference

The following attributes are exported:

Import

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

$ terraform import alicloud_logtail_config.example tf-log:tf-log-store:tf-log-config