从 Logstash 更新到 Elastic Search 失败

Update from Logstash to Elastic Search failed

我想用 logstash 解析一个简单的日志文件,post 将结果进行弹性搜索。我已经根据 log stash documentation.

配置了 logstash

但是 Logstash 报错:

Attempted to send a bulk request to Elasticsearch configured at '["http://localhost:9200/"]',
but Elasticsearch appears to be unreachable or down!
{:client_config=>{:hosts=>["http://localhost:9200/"], :ssl=>nil,
:transport_options=>{:socket_timeout=>0, :request_timeout=>0, :proxy=>nil,
:ssl=>{}}, :transport_class=>Elasticsearch::Transport::Transport::HTTP::Manticore,
:logger=>nil, :tracer=>nil, :reload_connections=>false, :retry_on_failure=>false,
:reload_on_failure=>false, :randomize_hosts=>false}, :error_message=>"Connection refused",
:level=>:error}

我的配置是这样的:

input { stdin{} }

filter {
    grok {
        match => { "message" => "%{NOTSPACE:demo}"}
    }
}

output {
  elasticsearch { hosts => "localhost:9200"}
}

调用时当然可以使用elasticsearchhttp://localhost:9200/

版本:logstash-2.0.0、elasticsearch-2.0.0 OSX

我发现 thread 有类似的问题。但这似乎是旧版 logstash 中的错误。

我将本地主机更改为 127.0.0.1

这个有效:

output {
  elasticsearch { hosts => "127.0.0.1:9200"}
}