Hi.
I'm facing a problem with creating dynamic index names. I have few if statemnts like shown below to add new fields, but I can't see anything in kibana when I try to name index dynamically based on its value.
filter {
if [host] =~ /pattern/ {
mutate {
add_field => {"site_code" => "code1"}
add_field => {"region" => "region1"}
}
}
else {
mutate {
add_field => {"site_code" => "code2"}
add_field => {"region" => "region2"}
}
}
Some parsing here...
}
output {
elasticsearch {
hosts => "http://address:9200"
index => "syslog-%{[site_code]}-%{+YYY.MM.dd}"
user => "name"
password => "pass"
}
}
I tried a different example where I'm using [host] field instead of [site_code] that I created and it works.
output {
elasticsearch {
hosts => "http://address:9200"
index => "syslog-%{[host]}-%{+YYY.MM.dd}"
user => "name"
password => "pass"
}
}
Is there any difference between [host] field and the [site_code] field that I created? Can I use it somehow to create dynamic indexes or am I doing something wrong?