DSL
灵活多变,有冷热分区就使用冷热分区,没冷热分区则使用热节点
# ilm
# 这里没有设置 冷热数据区 默认直接在热区 180天后删除
PUT _ilm/policy/spring-boot-logs-policy
{
"policy": {
"phases": {
"hot": {
"min_age": "0ms",
"actions": {
"rollover": {
"max_size": "5gb",
"max_age": "10d",
"max_docs": 1000000
},
"set_priority": {
"priority": 100
}
}
},
"delete": {
"min_age": "180d",
"actions": {
"delete": {
"delete_searchable_snapshot": true
}
}
}
}
}
}
PUT /_component_template/log-settings
{
"template": {
"settings": {
"index.lifecycle.name": "spring-boot-logs-policy",
"number_of_replicas": 0
}
}
}
PUT /_component_template/log-mappings
{
"template": {
"mappings" : {
"properties" : {
"@timestamp" : {
"type" : "date",
"format": "yyyy-MM-dd HH:mm:ss:SSS||yyyy-MM-dd HH:mm:ss||date_optional_time||epoch_millis"
}
}
}
}
}
PUT /_index_template/spring-boot-logs-stream-template
{
"index_patterns": [ "spring-boot-logs*" ],
"data_stream": {},
"priority": 200,
"composed_of": ["log-settings", "log-mappings"]
}