The huaweicloud_lts_structuring_custom_configuration resource allows you to manage Log Tank Service (LTS) structuring custom configurations. These configurations define how log events are parsed and structured into searchable fields.
To use this resource, you must provide a sample content log event. LTS uses this sample to generate parsing rules. You must choose exactly one of the following parsing methods:
- JSON structuring: Use the
layers argument to specify the maximum parsing layers (up to 3). This parses the log body as JSON and splits it into key-value pairs. - Split structuring: Use the
tokenizer argument to specify a delimiter (e.g., spaces or colons) to split the log body. - Nginx structuring: Use the
log_format argument to provide an Nginx configuration string for extracting key-value pairs from Nginx log events. - Custom Regex structuring: Use the
regex_rules argument to provide a regular expression for parsing logs.
Note: regex_rules, layers, tokenizer, and log_format are mutually exclusive.
resource "huaweicloud_lts_structuring_custom_configuration" "test" {
log_group_id = "your_log_group_id"
log_stream_id = "your_log_stream_id"
content = "sample log content"
# Choose ONE of: layers, tokenizer, log_format, or regex_rules
tokenizer = " "
demo_fields {
field_name = "field1"
content = "value1"
type = "string"
is_analysis = true
}
}