Hi!
I'm trying to dynamically set index names with if-cases in my logstash.conf file. Basically if file name is A then indexname should be A. But for some reason my variable (type) is not set or accessible when I get to the output section leaving me with an index name like : %{type}-2015-05-10
What am I doing wrong?
This is my config:
input {
file {
path => "/somefolder/*.log"
start_position => beginning
sincedb_path => "somfilelocation"
}
}
filter {
if [path] = condition_a {
mutate { replace => { "type" => "ToBeIndexName" } }
}
elseif [path] = condition_b {
mutate { replace => { "type" => "ToBeIndexName" } }
}
Some parsing
output {
elasticsearch {
index => "%{type}-%{+YYYY.MM.dd}"
}
}