Logstash成功启动但不起作用

时间:2019-12-01 20:56:08

标签: csv elasticsearch logstash kibana elastic-stack

我有一个包含此设置和映射的索引。

PUT /amazon_products
{
"settings": {
  "number_of_shards": 1,
  "number_of_replicas": 0,
  "analysis": {
    "analyzer": {}
    }
 },
"mappings": {
  "properties": {
    "id": {
      "type": "keyword"
     },
    "title": {
      "type": "text"
    },
    "description": {
      "type": "text"
    },
    "manufacturer": {
      "type": "text",
      "fields": {
        "raw": {
          "type": "keyword"
        }
      }
    },
    "price": {
      "type": "scaled_float",
      "scaling_factor": 100
      }
    }
  }
}

此字段也存在于我的 .csv 文件中,我想使用 logstash 将数据从csv文件发送到 elasticsearch
这是我的logstash配置文件:

input {
  file {
    path => "E:\ElasticStack\Logstash\products.csv"
    start_position => "beginning"
    sincedb_path => "NULL"
   }
}
filter {
  csv {
      separator => ","
      columns => ["id","title","description","manufacturer","price"]
  }
}
output {
  elasticsearch {
     hosts => "http://localhost:9200"
     index => "amazon_products"
  }
  stdout {}
}

何时使用此命令 .\logstash -f ..\config\logstash.conf logstash的唯一消息是:
已成功启动Logstash API端点{:port => 9600} ,并且不会将数据发送到elasticsearch
请帮我。谢谢:)

2 个答案:

答案 0 :(得分:1)

尝试将sincedb_path参数设置为“ NUL”。

答案 1 :(得分:1)

即使在Windows上,也要在路径配置中使用正斜杠,也要将sincedb_path更改为NUL

在您的输入中尝试此配置

input {
  file {
    path => "E:/ElasticStack/Logstash/products.csv"
    start_position => "beginning"
    sincedb_path => "NUL"
   }
}