这是logstash输出筛选器示例。
output
{
elasticsearch
{
hosts => ["localhost"]
sniffing => true
manage_template => false
index => "mqtt-index-%{+YYYY.MM.dd}"
document_id => "%{parsedMessage.device_id}"
document_type => "iot_data"
}
}此代码将现有_id更改为%{parsedMessage.device_id}。如何通过另一个字段更改_id?
发布于 2018-01-24 18:19:09
已从筛选器中删除目标选项。
filter { json { source => "message" } }
并使用以下输出创建自定义文档id。
output
{
elasticsearch
{
hosts => ["localhost:9200"]
sniffing => true
manage_template => false
index => "mqtt-index-%{+YYYY.MM.dd}"
document_id => "%{device_id}"
document_type => "iot_data"
}
}发布于 2018-01-23 17:36:47
符号不正确,你需要这样做
document_id => "%{[parsedMessage][device_id]}"https://stackoverflow.com/questions/48398360
复制相似问题