【问题标题】:elasticsearch is not indexing from logstash.confelasticsearch 没有从 logstash.conf 索引
【发布时间】:2016-01-12 17:14:00
【问题描述】:

我是 elasticsearch 新手,这是我的 logstash.conf 文件

input {
   #stdin {}
  file {
    path => "/demo_logs/2015-12-14.txt"
    start_position => "beginning"
  }
}

filter {
     csv {
        columns => ["data_date", "ip", "method", "status", "time"]
        separator => ","
    }
}

output {
  elasticsearch {
        action => "index"
        hosts => "localhost"
        index => "logstash-%{+YYYY.MM.dd}"
        workers => 1
}
  stdout { codec => rubydebug }
}

我已经使用 /bin/logstach -f logstash.conf 触发了 conf 文件 loggstash 已启动,没有任何关于打开文件并在 elasticsearch 中编制索引的进程

所以我只是取消注释标准输入{}以获取终端中的输入,如下所示

input{
       stdin {}
       #file {
        #path => "/demo_logs/2015-12-14.txt"
        #start_position => "beginning"
      #}
}

我再次运行了 conf 文件并将值插入为

2015-12-14 07:29:24.356302,127.0.0.1,get_names,exit,0:00:00.298635

它的显示错误为

Trouble parsing csv {:field=>"message", :source=>"", :exception=>#<NoMethodError: undefined method `each_index' for nil:NilClass>, :level=>:warn}

任何人都可以在这两件事上提供帮助以从 .txt 文件成功执行 logstash.conf 文件并成功索引该 .txt 文件中的所有值。

我也尝试过使用 grok 过滤器,但我做不到,如果它的 grok 过滤器对我也很好的话

谢谢

【问题讨论】:

  • 您使用的是哪个版本的 Logstash?
  • 用 elasticsearch_http 代替 elasticsearch 怎么样?

标签: elasticsearch indexing logstash logstash-grok


【解决方案1】:

这可能主要是因为您的数据包含空行。如果它是一个日志文件,您可以在 notepad++ 中打开它并转到编辑-> 行操作-> 删除空白行。希望这会有所帮助

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-05-06
    • 1970-01-01
    • 2019-06-21
    • 2017-02-14
    • 1970-01-01
    • 2016-11-26
    • 2016-03-24
    • 1970-01-01
    相关资源
    最近更新 更多