Sync mongodb and elastic using logstash

I have same problem with logstash issue Sync mongodb data to elasticsearch(update if exists or insert) using logstash

https://discuss.elastic.co/t/sync-mongodb-data-to-elasticsearch-update-if-exists-or-insert-using-logstash/206897/2

if someone solved this probelm help me
thank you

I just want to sync the data from mongodb to elastic using logstash. Its working good, when any new record comes in mongodb, logstash pushes into elastic. But when I update any record in mongodb then it does not change into elasticsearch. I want to make changes in the config file so that when any record updates in mongo it should reflect in elastic as well.

I have already tried by making action => "index" as well as action =>"update" in .conf file.

input{
mongodb{
uri => 'mongodb://localhost:27017/DBname'

placeholder_db_dir => '/opt/logstash'
placeholder_db_name => 'logstash_sqlite.db'
collection => "collectionName"
batch_size => 500
}
}

filter {
mutate {
remove_field => [ "_id" ]
}
}

output{
elasticsearch{
action => "index"
hosts => ["localhost:9200"]
index => "mongo_hi_log_data"
}
stdout{ codec => rubydebug }
}

This was designed for parsing logs that were written into mongodb. This means that it may not re-parse db entries that were changed and already parsed.

based on this

are you using that plugins? because i don’t see mongodb plugins in official elastic documentation

I'm using these plugins :

RUN logstash-plugin install logstash-output-elasticsearch
RUN logstash-plugin install logstash-input-mongodb

and installed successfully.

I have seen update actions in logstash docs

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.