The article details on how to use custom Index/Type name when using Logstash for proessing logs and Elasticsearch as Output.
input { file { } } filter { grok { pattern => "%{NUMBER:attribute1} %{GREEDYDATA:attribute2}" } ruby { code => ' event["custom_index_name"] = event["attribute1"] event["custom_type_name"] = event["attribute2"] ' #You can also set an field or modify an existing field to suit your needs } } output { elasticsearch { host => localhost index => "index_name_%{custom_index_name}" index_type => "type_name_%{custom_type_name}" #You can also use index => "index_name_%{attribute1}" if you do not want to modify the field name #Other Configuration } stdout { codec => rubydebug } }
This feature can also be used when using Custom Filters to emit events manually.