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
-> NOTE: Available since v1.93.0.
Example Usage
Basic Usage
resource "random_integer" "default" {
max = 99999
min = 10000
}
resource "alicloud_log_project" "example" {
project_name = "terraform-example-${random_integer.default.result}"
description = "terraform-example"
}
resource "alicloud_log_store" "example" {
project_name = alicloud_log_project.example.project_name
logstore_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.project_name
logstore = alicloud_log_store.example.logstore_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
}
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:
project
- (Required, ForceNew) The project name to the log store belongs.logstore
- (Required, ForceNew) The log store name to the query index belongs.input_type
- (Required) The input type. Currently only two types of files and plugin are supported.log_sample
- (Optional) The log sample of the Logtail configuration. The log size cannot exceed 1,000 bytes.name
- (Required, ForceNew) The Logtail configuration name, which is unique in the same project.output_type
- (Required, ForceNew) The output type. Currently, only LogService is supported.input_detail
- (Required) The logtail configure the required JSON files. (Refer to details)last_modify_time
- (Computed) This parameter is auto generated by server, please do not fill in.
Attributes Reference
The following attributes are exported:
id
- The ID of the log store index. It formats of<project>:<logstore>:<config_name>
.
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
文档内容是否对您有帮助?