首页 > 技术文章 > Logstash 7.5 导入数据到ES7.5

xibuhaohao 2020-05-20 16:44 原文

一、导入到ES单个字段

cat  json.conf

file {

  path => "/home/mongodb/vsmongo.json"

  type => "myfirst"

  start_position => "beginning"

 

}

}

output {

  if [type] == "myfirst" {

    elasticsearch {

      hosts => ["192.168.3.14:9200"]

      index => "vscontentmongodb-%{+YYYY.MM.dd}"

}

}

}

二、导入json数据到ES

cat  json.conf

file {

  path => "/home/mongodb/vsmongo.json"

  type => "myfirst"

  start_position => "beginning"

  codec => json {

  charset => "UTF-8"

}

}

output {

  if [type] == "myfirst" {

    elasticsearch {

      hosts => ["192.168.3.14:9200"]

      index => "vscontentmongodb-%{+YYYY.MM.dd}"

}

}

}

推荐阅读