Logstash 7.5 导入数据到ES7.5

一、导入到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}"

}

}

}

原文地址:https://www.cnblogs.com/xibuhaohao/p/12924510.html