将XML文件中的Logstash读取到Elasticsearch

时间:2014-12-08 20:10:19

标签: xml elasticsearch logstash

我有以下logstash配置文件:

input {
  stdin {
    type => "stdin-type"
  }

  file {
     type => "file"
     path => "/Users/jhwhite/Downloads/search_result/*.xml"
    }
}

output {
  stdout { }
  elasticsearch { host => "localhost" protocol => "http" }
}

当我运行bin/logstash -f logstash-simple.conf时,我收到以下错误:

Exception in thread ">output" org.elasticsearch.discovery.MasterNotDiscoveredException: waited for [30s]
    at org.elasticsearch.action.support.master.TransportMasterNodeOperationAction$3.onTimeout(org/elasticsearch/action/support/master/TransportMasterNodeOperationAction.java:180)
    at org.elasticsearch.cluster.service.InternalClusterService$NotifyTimeout.run(org/elasticsearch/cluster/service/InternalClusterService.java:492)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(java/util/concurrent/ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(java/util/concurrent/ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(java/lang/Thread.java:745)

当我从Logstash(http://logstash.net/docs/1.4.2/tutorials/getting-started-with-logstash)运行入门指南时,我尝试从外部conf文件读取内容时会遇到同样的事情。

如何让Logstash读入外部xml文件集合?

1 个答案:

答案 0 :(得分:2)

您需要在弹性搜索行中包含逗号或换行符 - 即:

elasticsearch { host => "localhost", protocol => "http" }

elasticsearch { 
  host => "localhost" 
  protocol => "http" 
}