Can Logstash run update operation in MongoDb

I am using Logstash 6.2.4 for replicate data from a MS Sql Server table to a collection MongoDB. Since the records are inserted in the source table, they can be updated with new information. I need to update these new information in the existing records in MongoDB. Does anyone know if it's possible to update a record in MongoDB using Logstash? How can I do it?

Thanks.

The mongodb output plugin?

Hi Magnus!
Yes, I am using the mongodb output plugin. My pipeline code is look like this:

input {
 jdbc {
    jdbc_driver_library => "/usr/local/java/jdk1.8.0_171/lib/sqljdbc42.jar"
    jdbc_driver_class => "com.microsoft.sqlserver.jdbc.SQLServerDriver"
    jdbc_connection_string => "jdbc:sqlserver://xxx.xxx.xx.xx:1433;databaseName=xxxx"
    jdbc_user => "xxxxxx"
    jdbc_password => "xxxxx"
    statement => "select * from table  where data >= getdate()-10"
    #schedule => "* 1 * * *" # todo dia a 1h. "min hor dia mes fuso"
    #clean_run => true
    #record_last_run => true
    #use_column_value => false #para o sql_last_value fucionar para data
    #tracking_column => "data"
  }
}
# The filter part of this file is commented out to indicate that it is
# optional.
# filter {
#
# }
output {
  mongodb {
    uri => "mongodb://xxx.xx.x.xx:27017,xxx.xx.x.xx:27017,xxx.xx.x.xx:27017/"
    database => "databaseName"
    collection => "collectionName"
    #_id => "%{id}"


  }

}

I will run this pipeline every day. Then, I need to update the records that are saved in MongoDB because the source records have new values in some attributes.

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