I want to read the source of the csv data and redirect the output to a different ElasticSearch index.
I tried as below (if condition with source in output) by following various discussions but it did not work. It is always going to else part.
Here is my logstash config:
input {
beats {
port => "5044"
}
}
filter {
csv {
autodetect_column_names => true
separator => ","
remove_field => ["message"]
}
}
output {
**if [source] == 'E:\\test_ingest\\test.csv'** {
elasticsearch {
hosts => "localhost:9200"
manage_template => false
index => "test_index"
document_type => "nasuni_log"
}
} else {
elasticsearch {
hosts => "localhost:9200"
manage_template => false
index => "b_index"
document_type => "nasuni_log"
}
}
}