【问题标题】:Sending data to ES index using Logstash?使用 Logstash 将数据发送到 ES 索引?
【发布时间】:2017-02-24 16:46:46
【问题描述】:

ES 2.4.1 Logstash 2.4.0

我正在从本地向 elasticsearch 发送数据以创建索引“pica”。我使用了以下 conf 文件。

input {
      file {
        path => "C:\Output\Receive.txt"
        start_position => "beginning"
        codec => json_lines

      }
    }
    output {
      elasticsearch {
        hosts => "http://localhost:9200/"
        index => "pica"
    }
    stdout{
    codec => rubydebug
    }
    }

我在 logstash 提示符或 elasticsearch 集群中都看不到任何输出。 当我看到 .sincedb 文件时,它具有以下代码: 612384816-350504-4325376 0 0 3804

我可以知道这里有什么问题吗?

谢谢

【问题讨论】:

    标签: logstash


    【解决方案1】:

    我猜你错过了 hosts 值的方括号 [],因为它是 doc 的一种 array 类型。因此它应该看起来像:

    elasticsearch {
         hosts => ["localhost:9200"]  
         index => "pica"
    }
    

    hosts => ["127.0.0.1"] OR hosts => ["localhost"]
    

    【讨论】:

    • 当我删除输入中的 codec=>json_lines 时它工作正常可能是我的文件内容格式问题我认为是这样..谢谢
    猜你喜欢
    • 1970-01-01
    • 2016-08-09
    • 2019-09-19
    • 2016-01-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多