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}"

}

}

}

你可能感兴趣的:(Logstash 7.5 导入数据到ES7.5)