This is sample logstash output filter.
output
{
elasticsearch
{
hosts => ["localhost"]
sniffing => true
manage_template => false
index => "mqtt-index-%{+YYYY.MM.dd}"
document_id => "%{parsedMessage.device_id}"
document_type => "iot_data"
}
}
This code changes existing _id as %{parsedMessage.device_id} as it is. How to change _id by another field?
1 Like
you can replace "parsedMessage.device_id"
in document_id => "%{parsedMessage.device_id}"
by any other field you like.
thank you devil_srj7......i got it, but the point is that it takes this string as it is as _id like,
_id = %{parsedMessage.device_id}
Thank you magnusbaeck. But, this is not nested field. The field name itself is parsedMessage.device_id
Replace the elasticsearch output with a stdout { codec => rubydebug }
output and show an example event produced by Logstash.
system
(system)
Closed
February 20, 2018, 12:23pm
8
This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.