Logstash used to synchronize data MongoDB es

input{
  mongodb{
        codec => "json"
        uri => 'mongodb://127.0.0.1:27017/kuaibao'
        placeholder_db_dir => '/usr/local/etc/logstash-5.6.0/dbdir'
        placeholder_db_name =>'user.db'
        collection => 'user'
        generateId => 'true'
        parse_method => "simple"
    }
}

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

output{
 elasticsearch{
  hosts => ["http://127.0.0.1:9200"]
  index => "ordertrance"
  manage_template=>true
  document_type=>"user"
}
stdout {
        codec => json_lines
    }
}

  

The configuration above, encountered a pit, my card for two days, I go. . . .

At first I placeholder_db_dir is configured became /usr/local/etc/logstash-5.6.0, which is the root of logstash, who become like this actually configured to do so, a variety of all kinds of cereal Baidu song, obviously with others the configuration is the same, I is not synchronized went es. Almost died mysteriously last tried to modify a bit placeholder_db_dir, actually can, and vomiting blood. . .

Guess you like

Origin www.cnblogs.com/zjdeblog/p/11183865.html