Hi, guys!
I want to manipulate output indexes in my output section. The config example below don't work. I need insert data into one index when host_name index is present or another if not.
Field kubernetes.labels.devops_destination field in both condition should be == "logs"
output {
if [vs-service] == "nameofservice" {
elasticsearch {
hosts => ["${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}"]
manage_template => false
ssl_certificate_verification => false
user => "user"
password => "${PASSWORD}"
index => "%{[vs_service]}_%{[accountcode]}"
}
}
else if [kubernetes][labels][devops_destination] == "logs" and "" in [host_name] {
elasticsearch {
hosts => ["${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}"]
manage_template => false
ssl_certificate_verification => false
user => "user"
password => "${PASSWORD}"
index => "%{[kubernetes][labels][devops_destination]}-%{[host_name]}-%{+YYYY.MM.dd}"
}
}
else if [kubernetes][labels][devops_destination] == "logs" {
elasticsearch {
hosts => ["${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}"]
manage_template => false
ssl_certificate_verification => false
user => "user"
password => "${PASSWORD}"
index => "%{[kubernetes][labels][devops_destination]}-%{[kubernetes][namespace]}-%{+YYYY.MM.dd}"
}
}
else {
elasticsearch {
hosts => ["${ELASTICSEARCH_HOST}:${ELASTICSEARCH_PORT}"]
manage_template => false
ssl_certificate_verification => false
user => "user"
password => "${PASSWORD}"
index => "recyclebin-%{+YYYY.MM.dd}"
}
}
}