I am using two indices each index is pointed to ilm.
below is the index setting for two indices
"index": {
"lifecycle": {
"name": "packetbeat_flow",
"rollover_alias": "log-pb-flow"
},
"number_of_shards": "1",
"number_of_replicas": "1"
}
"index": {
"lifecycle": {
"name": "packetbeat_dns",
"rollover_alias": "log-pb-dns"
},
"number_of_shards": "1",
"number_of_replicas": "1"
}
ILM Policy for packetbeat_flow
PUT _ilm/policy/packetbeat_flow
{
"policy": {
"phases": {
"hot": {
"min_age": "0ms",
"actions": {
"rollover": {
"max_age": "30d",
"max_size": "50gb"
},
"set_priority": {
"priority": 100
}
}
},
"warm": {
"min_age": "2d",
"actions": {
"set_priority": {
"priority": 50
},
"shrink": {
"number_of_shards": 1
},
"allocate": {
"require": {
"data": "warm"
},
"number_of_replicas": 1
}
}
},
"delete": {
"min_age": "30d",
"actions": {
"delete": {
"delete_searchable_snapshot": true
}
}
}
}
}
}
ILM Policy for packetbeat_dns
PUT _ilm/policy/packetbeat_dns
{
"policy": {
"phases": {
"hot": {
"min_age": "0ms",
"actions": {
"rollover": {
"max_age": "30d",
"max_size": "50gb"
},
"set_priority": {
"priority": 100
}
}
},
"warm": {
"min_age": "2d",
"actions": {
"set_priority": {
"priority": 50
}
}
},
"delete": {
"min_age": "30d",
"actions": {
"delete": {
"delete_searchable_snapshot": true
}
}
}
}
}
}
In logstash pipeline file
output {
if[agent][type]=="packetbeat"
{
if[type]=="flow"
{
elasticsearch {
hosts => ["http://em1:9200","http://em2:9200"]
manage_template => false
ilm_rollover_alias => "log-pb-flow"
ilm_pattern => "000001"
ilm_policy => "packetbeat_flow"
}
}
if[type]=="dns"
{
elasticsearch {
hosts => ["http://em1:9200","http://em2:9200"]
manage_template => false
ilm_rollover_alias => "log-pb-dns"
ilm_pattern => "000001"
ilm_policy => "packetbeat_dns"
}
}
}
}
In elasticsearch log file
[2021-02-12T16:03:04,567][INFO ][o.e.x.i.IndexLifecycleTransition] [em2] moving index [log-pb-flow-000001] from [{"phase":"hot","action":"unfollow","name":"wait-for-index-color"}] to [{"phase":"hot","action":"rollover","name":"check-rollover-ready"}] in policy [packetbeat_flow]
[2021-02-12T16:03:04,594][INFO ][o.e.x.i.IndexLifecycleTransition] [em2] moving index [log-pb-dns-000001] from [{"phase":"hot","action":"unfollow","name":"wait-for-index-color"}] to [{"phase":"hot","action":"rollover","name":"check-rollover-ready"}] in policy [packetbeat_dns]
i am not getting any data the doc count is 0